Errors with the position of other people's characters on your client

Basically, I have a project which is a hot potato concept: a random person gets the bomb, you pass it to another player, they pass it to other players and it explodes eventually.

When running after someone who is running away from you, on your screen you’ll literally be right up against them, sometimes even nearly going on top of them. But the server and on the screen of other players you as being over 9 studs away from them, while your client prints that you are touching them. This problem occurs with everyone. My bomb does not pass unless it detects less than 5.5 studs away from a players collision box part (motor6’d to HumanoidRootPart) and the bomb.

Edit: Forgot to mention, the density of the players is lowered so there is a sliding effect for the players. The density changes when you have the bomb or not, could this be a problem with the replication of a character’s movements? If so what can I do?

I really do not know how to overcome this problem and it would be great if someone could tell me what to do ASAP. Also sorry about the weird title, I’m not quite sure how to describe my problem in it.

If you need any references to scripts then please private message.

2 Likes

Screenshot of the problem:

I turned the custom character density off and the problem still occurs.

Do you use any local scripts to modify the position of the character on the client.

I mean, because if you do, the server will see you as being somewhere you aren’t

EDIT: Please ignore this, it’s wrong

Nope, I haven’t.

Can you try pasting over some of your scripts into another place without the character manipulations to see if that is affecting a anything?

Yeah, it’s very weird, and inconsistent. Sometimes the problem occurs, sometimes it doesn’t.

Would you mind posting a screenshot of the server and the client so that we can compare them?


Very interesting, it seems like the player is colliding with something? (also, the server view looks exactly the same, it’s just hard to move camera around with server so i switched to view of other player)

I’m assuming that the player colliding with something could be the other player in the game. However, as you said, the player is around six studs behind where they should be.

That’s very confusing.

Is there something which could be slowing down the replication of the player to the server and the other servers? From the screenshots you sent, it does look like a lag issue.

It does seem to be a lag issue, I know but this is a blank studio file, and also my computer slows down a bit when im recording and with two players running. However, when I turned the collisions off they do not look like they are colliding with stuff, but they do stay around 6 studs away and then the bomb just teleports to you.

What’s your code?

Server:

Event.OnServerEvent:Connect(function(Player,HitCharacter,HitCollisionPart)
	if Player.Character ~= nil and HitCharacter ~= nil then
		local Character = Player.Character
		local HitHumanoid = HitCharacter:FindFirstChild("Humanoid")
		local HitHumanoidRootPart = HitCharacter:FindFirstChild("HumanoidRootPart")
		if Character == Tool.Parent 
		and Character ~= HitCharacter
	 	and HitHumanoidRootPart 
		and HitHumanoid 
		and HitHumanoid:GetState() ~= Enum.HumanoidStateType.Dead
		and HitCollisionPart ~= nil 
		and HitCollisionPart:IsA("BasePart") 
		and HitCollisionPart.Parent == HitCharacter 
		and HitCollisionPart.Name == "CollisionPart"
		then	
		
			local FoundBomb = HitCharacter:FindFirstChild("Bomb")
			if FoundBomb and FoundBomb.ClassName == "Tool" and FoundBomb:FindFirstChildWhichIsA("BasePart") then		
				--not hit
			else		
				local Magnitude = (HitCollisionPart.Position - Hitbox.Position).Magnitude
				if Magnitude < 5.5 then
					spawn(function()				
						Pass(Character,HitCharacter)	
					end)	
				else 
					print(Character.Name .. " : " .. HitCharacter.Name .. " " .. Magnitude)
				end
			end
		end
	end
end)

Client:

   `    function HitHandler(Hit)
Character = Player.Character
if Tool.Parent == Character then
	local HitCharacter = Hit.Parent
	local HitHumanoid = HitCharacter:FindFirstChild("Humanoid")
	local HitHumanoidRootPart = HitCharacter:FindFirstChild("HumanoidRootPart")
	if HitCharacter and HitCharacter ~= Character and HitHumanoidRootPart and HitHumanoid then
		print(Hit.Name .. " " .. HitCharacter.Name)
		if Hit.Name == "CollisionPart" then
			Event:FireServer(HitCharacter,Hit)
			--Ting(HitHumanoidRootPart)
		end
	end	
end

end`

What I meant yes

Why can’t you just scrap all of this and use .Touched() on the server?

That is absolutely begging for inconsistencies.

.Touched() on the server can be kind of inconsistent at times too, and if I did it on the server it wouldn’t help my problem because players would be touching the other player on their screen but not on the server, which would be quite annoying.

1 Like

Yes, but it’s better than this. You will always have inconsistencies when it comes to things like this.

players would be touching the other player on their screen but not on the server, which would be quite annoying.

Players are touching the player on the other screen. Character posititions automatically replicate to the server. Wherever the client’s character is is where it is on the server.

.Touched() is the best method to do what you want. You’ll never win sending things to the server like you are.

Just out of interest, when and where is the hit handler called? Is it called from a touched event, raycasting…?

My bad it cut it out, it is a .Touched() on client

I’ll try that and see

I’m still not really sure what’s actually causing the difference in the placement of the character. Why would it be misaligned so much?

This solution works fine to solve his problem with the detection of the collision, but it doesn’t really solve his issue with the character being displaced.

Does anybody have any ideas about how the character is being placed so far away from where the client sees it?