Im making a train door Open/Close animation and I have started scripting the train door Open function however It doesn’t seem to be working and it has no errors.
task.wait(5) -- these animations will be created when the train spawns
local DoorOpenAnimation = Instance.new("Animation", DoorFolder.Door)
DoorOpenAnimation.AnimationId = "rbxassetid://14387852813"
local DoorCloseAnimation = Instance.new("Animation", DoorFolder.Door)
DoorCloseAnimation.AnimationId = "rbxassetid://14387863027"
local OpenAnim = Animator:LoadAnimation(DoorOpenAnimation)
local CloseAnim = Animator:LoadAnimation(DoorCloseAnimation)
local function OpenDoor()
for _, interlockLight in InterlockLights do
interlockLight.Material = "Neon"
end
local UnlockSound = Instance.new("Sound", ProximityPrompt.Parent)
UnlockSound.Name = "DoorUnlock"
UnlockSound.RollOffMaxDistance = 100
UnlockSound.Volume = 1
local newEqualizer = Instance.new("EqualizerSoundEffect", UnlockSound)
newEqualizer.HighGain = 10
newEqualizer.LowGain = -80
newEqualizer.MidGain = -19.7
newEqualizer.Priority = 0
UnlockSound:Play()
DoorFolder.Door.InteriorDoorLight.Material = "Neon"
OpenAnim:Play()
OpenAnim.Ended:Connect(function()
for _, v in pairs(DoorFolder.PosOpen:GetDescendants()) do
if v:IsA("BasePart") or v:IsA("MeshPart") then
v.Transparency = 0
elseif v:IsA("TextLabel") then
v.TextTransparency = 0
end
end
end)
UnlockSound.Ended:Connect(function()
UnlockSound:Destroy()
print("sound ended")
end)
end
ProximityPrompt.Triggered:Connect(function(player)
OpenDoor()
end)
The Animation.Ended event gets fired so I dont really understand the issue here ![]()
And the “UnlockSound” does not play
Also can someone tell me when the best time is to use the :LoadAnimation() I heard it could be unoptimised if you do it inside a function that gets called multiple times.
edit: ive been trying and debugging and couldnt resolve this, also every time i press on my rig in the animation editor roblox studio crashes
