Strange glitch is appearing in my game when one player is actively using an animation and another player click the button to active their animation it will just deactivate the other players animation. If anyone knows why this is and can help me fix it that would be very helpful (:
Video showcasing glitch: https://youtu.be/mmn5RjQipkI
The local script use to detect when a player is using the animation.
local UserInputService = game:GetService("UserInputService") local rs = game:GetService("ReplicatedStorage") local AnimSalute = rs:WaitForChild("AnimSalute") local function atease(inputObject, gameProcessed) if inputObject.KeyCode == Enum.KeyCode.Z then AnimSalute:FireServer() end end UserInputService.InputBegan:Connect(atease)
A regular script used to animate the character.
math.randomseed(tick()) local rs = game:GetService("ReplicatedStorage") local AEremote = rs.AnimAtEase local Sremote = rs.AnimSalute local Cremote = rs.AnimCrouch local animations = {03174847886} local animations2 = {03174855696} local animations3 = {03174837885} local activeAtEase = false local activeSalute = false local activeCrouch = false function onAtEaseFire(plr) if not activeAtEase then -- Same as "if active == false" activeAtEase = true --change debounce local char = game.Workspace:FindFirstChild(plr.Name) local humanoid = char.Humanoid local animation = Instance.new("Animation") animation.AnimationId = "rbxassetid://"..animations[math.random(1, #animations)] animTrack = humanoid:LoadAnimation(animation) animTrack:Play() else --if active was true: activeAtEase = false animTrack:Stop() end end AEremote.OnServerEvent:Connect(onAtEaseFire) ------------------Salute function OnSaluteFire(plr) if not activeSalute then -- Same as "if active == false" activeSalute = true --change debounce local char = game.Workspace:FindFirstChild(plr.Name) local humanoid = char.Humanoid local animation = Instance.new("Animation") animation.AnimationId = "rbxassetid://"..animations2[math.random(1, #animations2)] animTrack = humanoid:LoadAnimation(animation) animTrack:Play() else --if active was true: activeSalute = false animTrack:Stop() end end Sremote.OnServerEvent:Connect(OnSaluteFire) ----------------Crouch function OnCrouchFire(plr) if not activeCrouch then -- Same as "if active == false" activeCrouch = true --change debounce local char = game.Workspace:FindFirstChild(plr.Name) local humanoid = char.Humanoid local animation = Instance.new("Animation") animation.AnimationId = "rbxassetid://"..animations3[math.random(1, #animations3)] animTrack = humanoid:LoadAnimation(animation) animTrack:Play() else --if active was true: activeCrouch = false animTrack:Stop() end end Cremote.OnServerEvent:Connect(OnCrouchFire)