#attempt to index nil
37 messages · Page 1 of 1 (latest)
You have to check if the raycast is hitting anything @runic elk
if Ray and Ray.Instance then
end
Could It be that the local scripts isn't fireing properly?
When I print the rwy
Ray
It says nil
Every time
@proven ember
OH I know
Remote events on the server receive the player as the first parameter
so you would need to do
Event.OnServerEvent:Connect(function(player, ray))
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
tables are basically just a way to store information without making 15 different variables
actually, you don't need to do that here
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
ah ok
