TenBlocke
(Decablocks)
March 1, 2022, 2:31am
#21
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
TenBlocke
(Decablocks)
March 1, 2022, 2:33am
#23
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
TenBlocke
(Decablocks)
March 1, 2022, 2:35am
#24
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.
TenBlocke
(Decablocks)
March 1, 2022, 2:40am
#26
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.
TenBlocke
(Decablocks)
March 1, 2022, 2:46am
#28
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
Forummer
(Forummer)
March 1, 2022, 5:09pm
#30
You need to multiply the directional vector with a range (magnitude), which represents the distance of the ray.
I suggested this to the other thread you posted.