Why is this script broken?

Hey guys, I’m trying to animate doors for a train and there’s this weird issue:

When the driver presses the Door Open button, the all door animations play for the client who activated the doors (i.e. the driver) but only the last 3 door animations play for the other clients.

Driver:

Other clients:

The doors are activated by a GUIButton and a server script

button = script.Parent.Parent.Loco1.Drive.DriveGUI.drivinggui.Left
door = script.Parent.AnimationController.Animator
doorAnimation = Instance.new("Animation")
doorAnimation.AnimationId = "rbxassetid://6965838672"

button.MouseButton1Click:Connect(function()
	openAnim = door:LoadAnimation(doorAnimation)
	openAnim:Play()
end)

I’ve tried my best to fix this but I can’t find a solution. Tweening won’t work as the doors are plug-type.
Any help would be appreciated. Thanks!

This is only showing to the driver due to it only running on their client.
You will have to use remote events for it to replicate to everyone.

I made it work by replacing

button.MouseButton1Click:Connect(function()
	openAnim = door:LoadAnimation(doorAnimation)
	openAnim:Play()
end)

with

function DoorOpen()
	openAnim1 = door:LoadAnimation(doorAnimation1)
	openAnim1:Play()
end

button1.MouseButton1Click:Connect(DoorOpen)

anddd it works

So you need to use remote events