- What do you want to achieve? - I’m making a simple combat system where each time the player throws a punch, a ray will be cast in front of the player. If the ray touches a target, the player will automatically move to the target.
- What is the issue? - My raycast detection is done on the client and I make the player move on the server. Problem is, the detection doesn’t always register when I shoot out the rays too fast like this. What I found strange was that, when I transferred the raycasting to a server script, there was no issue, so I assume it’s a problem caused by the client.
Local Script
if raycastResults then
if raycastResults.Instance.Parent:FindFirstChild('Humanoid') then
local targetPosition = raycastResults.Position
moveEvent:FireServer(targetPosition)
end
end
- What solutions have you tried so far? I haven’t found a post relating to this issue specifically but I have tested the issue by printing whenever the ray hits something.
I shortened the script but it seems to be the source of the problem.
Any help would be appreciated!