So, it was always my belief that animations needed to be played from server scripts in order for everyone to see them; however, I have a bunch of animations that are played from local scripts that everyone can see (whether they loop or not). This being said, I am confused as to why one particular animation of mine is sometimes only visible to the client. Is it something within my code, or is it some kind of roblox error? Thanks in advance for anyone who has any ideas.
This code is in a local script within StarterGui.
local dance_debounce = true local function InputKey(Input, GameEvent) if GameEvent then return end if Input.KeyCode == Enum.KeyCode.P then if dance_debounce == true then dance_debounce = false local animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.DanceAnim) animation:Play() wait(1) dance_debounce = true end end end InputService.InputBegan:Connect(InputKey)
The only idea that i have is that you increase animation priority.
local dance_debounce = true local function InputKey(Input, GameEvent) if GameEvent then return end if Input.KeyCode == Enum.KeyCode.P then if dance_debounce == true then dance_debounce = false local animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.DanceAnim) animation.Priority = Enum.AnimationPriority.Action -- Max priority animation:Play() wait(1) dance_debounce = true end end end InputService.InputBegan:Connect(InputKey)
That because it's Local Script
Easy just change it to server script. and don't use game.Players.LocalPlayer
or use RemoteEvent