Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Why Don't Animations Play for Everyone?

Asked by 4 years ago

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)

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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)
Ad
Log in to vote
-1
Answered by
OnaKat 444 Moderation Voter
4 years ago
Edited 4 years ago

That because it's Local Script

Easy just change it to server script. and don't use game.Players.LocalPlayer

or use RemoteEvent

2
Not true, players control their own movements, everyone can see animations, even if placed in client. goodadmins 111 — 4y
1
^ Psudar 882 — 4y
1
^ EDLLT 146 — 4y

Answer this question