Player's character position showing incorrectly to people who joins server

Yeah, I know the title makes no sense. Anyways let’s come to the point. Recently we released [NEW] :helicopter: Vibe Helicopter, and we’ve been receiving multiple reports of that - characters are randomly sitting on air in random place. Most people goes insane when they sees this and ends up reporting the user who faced the glitch. But the victim doesn’t even realize that some people are watching him flying, because he’s absolutely normal on his screen, vibing on a seat.

So we grabbed some testers to find out why it was happening and figured out that it has to do something with the animation scripts. In game, the animations are played on client but they are replicated to Server. If you are in a server and someone plays animation, it just works fine.

Then when does the issue occur? Let’s suppose Player A is sitting on a seat and playing the “slouched” sitting animation. Player B is standing right behind them and watched Player A play the “slouched” animation. At that moment, Player C joins the server. They sees Player C at the correct place, but notices that Player A is flying outside of the helicopter, with “slouched” animation turned on.

So, basically when a player joins game - anyone who is sitting and playing animations’ character position will be shown incorrectly to the player who just joined.
This does not happen always though, but 70% of the time. No error in output as well.

I’ll provide the scripts that handles the animations.

LocalScript inside GUIButton that plays animation on click
local bg = script.Parent.BG
local button = script.Parent
local plr = game.Players.LocalPlayer
local animation = script.Parent.Parent.SeatAnimations[script.Parent.Text]

button.MouseButton1Click:Connect(function()
	local loadAnimation = plr.Character.Humanoid:LoadAnimation(animation) --// Load the animation into the humanoid
	loadAnimation:Play()
end)


local function onSit(isSeated, seat)
	if not isSeated then
		animation:Stop()
	end
end

plr.CharacterAdded:Connect(function(character)
	local humanoid = character:WaitForChild("Humanoid")

	humanoid.Seated:Connect(onSit)
end)
LocalScript inside StarterPlayerScript that stops animation when player gets off seat
local Player = game.Players.LocalPlayer


Player.Character.Humanoid:GetPropertyChangedSignal("Sit"):Connect(function()
	if Player.Character.Humanoid.Sit == false then
		if not Player.Character then return end
		wait(0.3)
		local AnimationTracks = Player.Character.Humanoid:GetPlayingAnimationTracks()
		for i, v in pairs(AnimationTracks) do
			v:Stop()
		end
	end
end)

There might be some game settings causing this issue as well. Any help is appreciated!

2 Likes

You should try doing it on a server script that runs when a RemoteEvent fires from a local script that detects when the Humanoid object stops sitting.

I hope I explained it right.

1 Like