So, I threw myself a challenge that I could make a game in 14 days a game about a train station where the train comes and goes.
The train itself works by Tween Service and the doors by animation (like the Stepford County Railway) and I recently noticed a serious problem:
I do not know why, but the door animation turns on as it should in the studio, but in the game animation does not turn on and no error does not say
Here are examples:
How it should and how it works in the studio:
How it happens in the game:
Here’s the script: (not full)
wait(5)
print("Doors")
local Doors = script.Parent:WaitForChild("AnimationController")
local Anim = script.Parent.Animation
local Play = Doors:LoadAnimation(Anim)
Play:Play()
wait(3.5)
Play:AdjustSpeed(0)
wait(24)
Play:AdjustSpeed(1)
Also I noticed when I saved this and through an alternate account turned on the train, animation did not work.
Here’s what’s in the train:
(The doors have rigs)
The script is NOT LOCAL
I don’t know what ways you can do it (My scripting knowledge is neither low nor high) and I don’t want to lose my own challenge.
If you open the console in-game (F9) are there any warnings or errors related to the animation? If not, you could also try re uploading the animation, or adjust animation settings. Also keep in mind that models and parts have to be unanchored in order to animate.
Edit: this is bad advice, but you could try replacing your animator with a humanoid and see if that works.
I wrote that there is no error or warning and the problem remains when I adjust the animation. The problem is that for some reason animation works only in the studio and only works when animation works by his name.
Can you add a print after the door animation is done and see if it prints successfully in roblox dev console?
Also this could be an idea, but it mostly likely not be the cause of the issue, but It could? idk
task.wait(5)
print("Doors")
repeat task.wait() until script.Parent:FindFirstChild("AnimationController") ~= nil
local Doors = script.Parent.AnimationController
local Anim = script.Parent.Animation
local Play = Doors:LoadAnimation(Anim)
Play:Play()
task.wait(3.5)
Play:AdjustSpeed(0)
task.wait(24)
Play:AdjustSpeed(1)
Could it be an inconsistency between who made the game and who owns the animation? Typically if an animation works in Studio but not in game, it could mean that the animation is not owned by the person who made the game.
If a group made the game, the group has to own the animation, and if a player made the game, the player has to own the animation.