Changing a character's position causes the server to think that it is rotated forward permanently

I have a script that teleports a player from one teleport part to the other when one of them is touched. When the player is teleported, the player looks normal on the client side, but the character is permanently tilted forward on the server side. The more I use the teleport pad, the more tilted the character looks on the server. Is there an explanation to this weird behaviour?

Edit: I found out that the problem occurs with the character’s running animation. The running animation makes the torso tilt forward slightly, and when the player is teleported while the running animation is playing, the server thinks that the torso is permanently tilted forward. How can i prevent this from happening without making the animation not affect the torso?

Could you show the script for this program? It’s hard to give an exact answer without clearly seeing the code itself.

1 Like

Vent 1 and Vent 2 just refer to the teleport pads, you can ignore sus-o-meter that does not affect the problem

local debouncetable = {}

script.Parent.Vent1.Vent1.Touched:Connect(function(otherpart)
	if otherpart.Parent:FindFirstChildWhichIsA("Humanoid") and otherpart.Parent.Humanoid.Health > 0 and game:GetService("Players"):GetPlayerFromCharacter(otherpart.Parent) then
		if debouncetable[otherpart.Parent] == true then return end
		debouncetable[otherpart.Parent] = true
		otherpart.Parent.HumanoidRootPart.Position = script.Parent.Vent2.Vent2.Position + Vector3.new(0, 2.5, 0)
		script.Parent.Vent2.Vent2.VentSound:Play()
		otherpart.Parent["Sus-o-meter"].Value += 4
		if otherpart.Parent["Sus-o-meter"].Value >= 10 then
			game:GetService("ReplicatedStorage").Events.AmogusAnimation:FireClient(game:GetService("Players"):GetPlayerFromCharacter(otherpart.Parent))
		end
		task.wait(2)
		debouncetable[otherpart.Parent] = nil
	end
end)

script.Parent.Vent2.Vent2.Touched:Connect(function(otherpart)
	if otherpart.Parent:FindFirstChildWhichIsA("Humanoid") and otherpart.Parent.Humanoid.Health > 0 and game:GetService("Players"):GetPlayerFromCharacter(otherpart.Parent) then
		if debouncetable[otherpart.Parent] == true then return end
		debouncetable[otherpart.Parent] = true
		otherpart.Parent.HumanoidRootPart.Position = script.Parent.Vent1.Vent1.Position + Vector3.new(0, 2.5, 0)
		script.Parent.Vent1.Vent1.VentSound:Play()
		otherpart.Parent["Sus-o-meter"].Value += 4
		if otherpart.Parent["Sus-o-meter"].Value >= 10 then
			game:GetService("ReplicatedStorage").Events.AmogusAnimation:FireClient(game:GetService("Players"):GetPlayerFromCharacter(otherpart.Parent))
		end
		task.wait(2)
		debouncetable[otherpart.Parent] = nil
	end
end)

Sorry it looks kind of ugly I know that ;-;

Sorry for the delay, anyways I think this is your issue:

try using CFrame instead of position for each spot the player is moved and how much they’re moved.

sorry i don’t understand what you mean by this

Here’s an example of what I mean:

Instead of saying

otherpart.Parent.HumanoidRootPart.Position = script.Parent.Vent2.Vent2.Position + Vector3.new(0, 2.5, 0)

Try saying

otherpart.Parent.HumanoidRootPart.CFrame = script.Parent.Vent2.Vent2.CFrame + Vector3.new(0, 2.5, 0)
1 Like

That works, but what is the difference between setting the CFrame and the position? Isn’t CFrame just position and rotation?

1 Like

Yeah pretty much, but because your character is rotating for some reason, calling CFame in this instance makes sure the character isn’t rotating. I could not tell you why your character’s rotating with .Position though because I can’t access my computer to test it right now

Simply, most of your cases should be using CFrame and not Position.