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

Animation plays online, but other players cannot see it?

Asked by 6 years ago

I created my own animation and you can trigger the animation by pressing "q"

This is a LOCAL SCRIPT:

Player = game.Players.LocalPlayer
Mouse = Player:GetMouse()
local fly = Player.Character:WaitForChild("Duck"):WaitForChild("AnimationController").Fly
local flying = Player.Character:WaitForChild("Duck"):WaitForChild("AnimationController"):LoadAnimation(fly)

Mouse.KeyDown:connect(function(key)
 if key == "q" and script.Fly.Value == false then
    script.Fly.Value = true
        flying:Play()
  end
 end
 if key == "q" and script.Fly.Value == true then
    script.Fly.Value = false
            flying:Stop()
    end
end)

The animation works fine in studio, and it DOES PLAY online, but only for the player triggering it, and other players can't see it.

When I tried to put it in a regular server script, that made the animation not play at ALL online.

What's the problem? ((Please be detailed in your answer, vague answers do not help me, thank you!))

4 answers

Log in to vote
0
Answered by
Jo_Bot 67
6 years ago

The reason it is only appearing for you is that you have Filtering Enabled on, which is recommended, but it also filters local scripts to only apply locally. I do not know if this is the problem, try changing it to a regular script.

0
most likely is the problem* Jo_Bot 67 — 6y
0
I have already tried putting it on a regular script, and that makes the animation not play at all. ShinyGriffin 129 — 6y
Ad
Log in to vote
0
Answered by
hellmatic 1523 Moderation Voter
6 years ago
Edited 6 years ago

Instead of using values, use a variable to determine if the player is flying or not.

Animations play for everyone with FilteringEnabled on without RemoteEvents.

local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character.Humanoid

local Mouse = Player:GetMouse()

local Animation = Instance.new('Animation')
Animation.AnimationId = "" -- paste your animation id here
local FlyTrack = Humanoid:LoadAnimation(Animation)

local Flying = false -- determines if the player is flying/not

Mouse.KeyDown:connect(function(key)
    if key == "q" and not Flying then
            Flying = true 
            FlyTrack:Play()

    elseif Flying then -- disable flying if Flying is true 
        Flying = false 
        FlyTrack:Stop()
    end
end)

0
Thanks, but when I put this on a server script, it doesn't work at all. When I put this on a Local Script, it works, but only I can see the animation, not other people. ShinyGriffin 129 — 6y
Log in to vote
0
Answered by 6 years ago

I have had that same problem before and most of the time it happens when ever the animation editor you use has a default looped or priority option that for some reason doesn't allow scripts to change those said properties of loaded animation track(s); you might want to try setting those properties in your editor and see if that fixes it (looped and priority). Also you want to make sure that if your animation is being looped that the length is around a good two seconds. From my experience, simply changing the properties in the animation editor itself and or changing the length to be longer usually resolves this issue. One more thing, make sure your only referencing the animations once in the scripts or more bugs/glitches could possibly occur. Hope this helped, bye!

Log in to vote
0
Answered by 6 years ago

Thank you for your input, I tried this too, and I'm still having the same problem: I can see my character's animation, but other players can't. I've been scratching my head on this for days and made several different scripts to tackle it, but none of them seem to make any difference.

local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Instance.new('Humanoid')
Humanoid.Parent = Character:WaitForChild("Duck")
local Mouse = Player:GetMouse()

local Fly = Instance.new('Animation')
Fly.AnimationId = "rbxassetid://1760611761"
local FlyTrack = Humanoid:LoadAnimation(Fly)

local Flying = false

Mouse.KeyDown:connect(function(key)
    if key == "q" and not Flying then
            Flying = true 
            FlyTrack:Play()

    elseif key == "q" and Flying then
        Flying = false 
        FlyTrack:Stop()
    end
end)

I used the script above in a SERVER script, which made the animation not play at all, and then on a LOCAL script, which made the animation play for me, but, others can't see it.

I changed the AnimationController I WAS using previously to play the animation to a Humanoid to see if that was the problem.

I also changed the priority of the animation to Action and made the animation longer (was 0.5 seconds, now its 2 seconds) and this didn't seem to change a thing.

You say that I don't need remote events for the animation to play on a character, so what else can I do?

0
Edit: Nothing worked for me until I used remote events, and now everything works. It looks like you do need remote events if you want your animation to play for you and other players. ShinyGriffin 129 — 6y

Answer this question