Hey, and thanks for reading in advance.
The game I’m creating has players changing their default animations on a semi-regular basis. The issue lies in player-to-player replication, and it’s a befuddling issue:
This is a 2-player psuedo-server in Studio. From my own perspective as the blue player, my idle animation shows me correctly holding the bow and my animations are correct.
From the red player’s perspective, however, the blue player’s animations are completely off. Running a print test shows that holdover tracks from blue’s previous animations are still playing, and if I forcibly stop those tracks on blue’s character from red’s client, blue will animate correctly after being moved again.
I should note: the server sends a signal to the client to change their own animations, but does not directly change them itself. I have tested merely changing animation IDs manually during the 2-player server test, and this seems to replicate the new animation set with no issues whatsoever - which makes things all the stranger when the code does the exact same thing and produces a different result.
I am using a slightly edited version of the default animation script, but only insofar as to interact with specific game elements; its core function remains unchanged. Snippets provided below.
Relevant code:
-- Client Animate Script
function replaceAnimSet(newSet)
for name,id in pairs(newSet) do
local holder = script:WaitForChild(name, 3)
local anim = holder and holder:FindFirstChildWhichIsA("Animation")
if anim then
anim.AnimationId = "rbxassetid://"..id
end
end
if canMove() then
stopAllAnimations()
onRunning(Torso.AssemblyLinearVelocity.Magnitude)
end
-- Note: The above four lines are not the source of the issue
lastMove = tick()
end
RS.Remotes.ChangeAnims.OnClientEvent:Connect(replaceAnimSet)
--- Server Side Code Example
local Anims = {
idle = 667862082, walk = 703972083,
jump = 992495040, fall = 994686148
}
RS.Remotes.ChangeAnims:FireClient(Player, Anims)
If anyone knows what could be causing this issue, I’d appreciate your help.