Help sending information from client to server

I see what’s wrong now

Don’t include the player parameter in your :FireServer(), as the server’s OnServerEvent’s first parameter is default to whoever fired it

script.Parent.Parent.FireGun:FireServer(mouse.Hit.Position) --only send mouse.Hit.Position
1 Like

I did that now I get this

sending a player variable through the :FireServer() will be read like this in the .OnServerEvent

localscript

RemoteEvent:FireServer(--localplayer--,mouse.Hit.Position)

How its read in the .OnServerEvent

Remote.OnServerEvent:Connect(function(player,TheSamePlayer, TheActualPosition)

end)
1 Like

its Raycast
not RayCast,
small c

1 Like

alright ive done that now there is no errors. does that mean the server script has the final results of the raycast now? I cant tell because im not getting any server feedback in the output.

Try to print ray.Instance inside the if ray then statement, if it prints then it works

if ray then
  print(ray.Instance.Name)
end
1 Like

Im not getting any server feedback.

Its working, its just that the ray is only firing like 1 stud facing your mouse.Hit.Position. How to fix this?

Multiply the Direction by as many studs you want the raycast to go

local ray = workspace:Raycast(origin, Direction * 1000, raycastParams) -- Direction * 1000 = 1000 studs in the direction facing mouse.Hit.Position
1 Like

It worked! Thank you for this.

1 Like

I suggested this to the other thread you posted.