Inconsistent touch Detection Across Clients

  1. What do you want to achieve?

I am creating a Roblox tag game where players need to tag each other. I want to ensure that the tagging mechanism works correctly and consistently across all clients.

  1. What is the issue?

I have a server script inside StarterCharacterScripts to detect if the tagger has touched the player. However, the issue is that sometimes on my screen, it shows that I touched my opponent, but on their screen, it shows that I did not touch them, yet they still get tagged. This discrepancy seems to be due to different player positions on different screens. Here are the videos demonstrating the issue:


  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

First I thought it was due to the script being a local script, So i changed it to a server script but the issue still remains. I’ve have tried to use alternative methods such as Raycast for collision detection, but the issue still keeps happening. I cant find any other solution to this problem on the Developer Hub.

Here is my current player collision script.

local replicated = game:GetService("ReplicatedStorage")
local TagEvent = replicated.RemoteEvents:WaitForChild("TagEvent")
local Player = script.Parent

script.Parent.HumanoidRootPart.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		if hit.Parent:FindFirstChild("Tagger") then
			if hit.Parent.Tagger.Value == true then
				TagEvent:FireAllClients(Player) 
			end
		end
	end
end)

If anyone has solutions, Could you please solve them?

Is the player movement server authoritative? If it’s client owned, then you will experience desynchronization between the server and client. Suppose the server registers the tagged event at time t, then what you see on your client is the chasing player at where he was at time t-1, and yourself at t+1 (your are in the “future” since your movement has not yet been replicated to the server, and the chasing player is in the “past” as his current position has not yet been replicated to your client).

I am using the default Roblox movement. The only change I made is that the player can use the arrow keys to move left and right, and the player can’t move forward and backward. I haven’t changed movement apart from that.

To my knowledge the default movement is client owned (you can verify by turning on network ownership debugging in studio settings), thus you would experience the aforementioned problems. Here’s a good article by Roblox staff which discusses the Touched event and network delay: Touch Events and Network Delay

If I were you, I would experiment with replacing the default movement controller with a basic server controller that anchors the player’s character and pivots it every frame based on the clients input. With this approach, you should experience input lag, but no desync. For advanced strategies, check out: Resources from the Roblox Creator Game Jam 2024 (Server Authoritative Tennis)

Hope this helps

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.