I'm currently working on an animation which plays, and stops for a brief moment. However, the variable "track" does not exist by the track:AdjustSpeed(0).
I tried to remove the "local" in the variable declaration, but then when I do, it shows an error.
Here's the script:
local button = script.Parent
local otherdoorbutton = script.Parent.Parent.DoorR
local db = false
button.MouseButton1Click:Connect(function()
local train = workspace[tostring(game.Players.LocalPlayer) .."Train"]
local dooropened = train.DoorOpened
for i = 1,6,1 do
local door = train["DoorL" ..tostring(i)]
local anim = door.OpenClose
local controller = door.AnimationController
local track = controller:LoadAnimation(anim)
if db == false then
if dooropened.Value =="NO" then
track:Play()
end
end
end
wait(3.5)
track:AdjustSpeed(0) --this does not work
end)
Any help will be appreciated!

1 comment
Ah I see. Thank you for your help!