Okay so I have been working on a train door system for the past 2 days and I thought scripting the animations would be easy but turns out not. Well the script works fine and as it should however the behaviour of the animation is very odd and if I tried to explain it, it would not make sense. This problem has been on my mind for as long as I can remember and I can’t seem to find a solution for it, at first I thought it was something to do with the animation priority but I dont think it is.
The problem:
So the animation track is a single door open animation that gets it’s speed adjusted using the adjustSpeed
function to make it an alternate door closing animation aswell isntead of having another animation. This animation gets activated by a proximity prompt which then calls this ControlDoor function. The problem here is that the animation is visible when I switch to the server but it’s not visible for the individual client? This makes absolutely no sense to me as everything on the server should be visible to everyone. If anyone has an idea of why this is happening please let me know as this issue has been bugging me for ages.
Script:
local function ControlDoor(State)
local function SetInterlock(material)
for _, interlockLight in InterlockLights do
interlockLight.Material = material
end
end
if State == true then
OpenAnim:AdjustSpeed(1)
OpenAnim:Play()
else
OpenAnim:AdjustSpeed(-1)
end
OpenAnim:GetMarkerReachedSignal("DoorIdle"):Connect(function()
OpenAnim:AdjustSpeed(0)
end)
OpenAnim:GetMarkerReachedSignal("Open"):Connect(function()
if DoorFolder.Door:GetAttribute("IsOpen") == true then
SetInterlock("SmoothPlastic")
DoorFolder.Door:SetAttribute("IsOpen", false)
else
SetInterlock("Neon")
DoorFolder.Door:SetAttribute("IsOpen", true)
end
end)
end
ProximityPrompt.Triggered:Connect(function(player)
if DoorFolder.Door:GetAttribute("IsOpen") == false then
ControlDoor(true)
ProximityPrompt.Enabled = false
task.wait(5)
ProximityPrompt.ActionText = "Open Door"
ProximityPrompt.Enabled = true
else
ControlDoor(false)
ProximityPrompt.Enabled = false
task.wait(5)
ProximityPrompt.ActionText = "Close Door"
ProximityPrompt.Enabled = true
end
end)
Notes:
- I’ve noticed that the door open/close animation plays on the
client
ages after it is activated while it already played on the server. - Im not sure if the proximity prompt action text is being set correctly so dont trust the Open Door action text on the proximity prompt visible on the screenshot