#attempt to index nil

37 messages · Page 1 of 1 (latest)

runic elk
#

The error comes every time i click

proven ember
#

You have to check if the raycast is hitting anything @runic elk

#
if Ray and Ray.Instance then
end
runic elk
#

Oh

#

But even when it's supposed to hit something it says that

runic elk
#

Could It be that the local scripts isn't fireing properly?

#

When I print the rwy

#

Ray

#

It says nil

#

Every time

runic elk
#

@proven ember

proven ember
#

Remote events on the server receive the player as the first parameter

runic elk
#

omg u might be jezus

#

il try

proven ember
#

so you would need to do

Event.OnServerEvent:Connect(function(player, ray))
runic elk
#

wait

#

nvm

#

thats what i did

#

local function Spawned(plr,ray)

proven ember
#

Oh nvm then

#

It's probably somethign with client/server thing, I wouldn't create the ray on the client tbh

#

Just make a table/ dictionary with all the necessary raycast info and then fire the ray from the server

runic elk
#

how do u do tables

#

ive never used them

proven ember
#

tables are basically just a way to store information without making 15 different variables

proven ember
#

just do this:

game.ReplicatedStorage.SpawnEvent:FireServer(MouseRay.Origin, MouseRay.Direction * 1000)
#

then receive it like this and do your raycast from there:

local function Spawned(plr,origin, direction)
  local ray = workspace:Raycast(origin, direction)
end
runic elk
#

ok ty

#

OHH

#

i think its bc i dint do

#
  • 1000
#

oh i did

#

ty bro

proven ember
#

ah ok