So I am currently working on a doors animation for a train, however I have ran into a slight problem
the doors IRL rotate so that’s what I want to happen in game, (video) however everything I have tried hasn’t worked and I cant get the door to rotate, it moves properly but will not rotate.
current Script is below (this is without the rotation stuff I have tried)
if script.Parent.Open.Value == true then
script.Parent.UpLeft.TargetPosition = 0
script.Parent.UpRight.TargetPosition = 0
wait(1)
script.Parent.UpLeft.Enabled = false
script.Parent.UpRight.Enabled = false
script.Parent.AcrossLeft.Enabled = true
script.Parent.AcrossRight.Enabled = true
wait(0.1)
script.Parent.AcrossLeft.TargetPosition = 0
script.Parent.AcrossRight.TargetPosition = 0
else
local x = math.random(1, 5)
if x == 1 then
wait(3.5)
script.Parent.AcrossLeft.TargetPosition = 4
wait(.5)
script.Parent.AcrossRight.TargetPosition = 4
wait(2)
script.Parent.UpLeft.Enabled = true
script.Parent.AcrossLeft.Enabled = false
script.Parent.UpRight.Enabled = true
script.Parent.AcrossRight.Enabled = false
wait(.1)
script.Parent.UpLeft.TargetPosition = 0.5 ------------- .2
script.Parent.UpRight.TargetPosition = 0.5
wait(0.3)
script.Parent.UpRight.Enabled = true
script.Parent.AcrossRight.Enabled = false
elseif x == 2 then
wait(3.5)
script.Parent.AcrossRight.TargetPosition = 4
wait(.5)
script.Parent.AcrossLeft.TargetPosition = 4
wait(2)
script.Parent.UpRight.Enabled = true
script.Parent.AcrossRight.Enabled = false
script.Parent.UpLeft.Enabled = true
script.Parent.AcrossLeft.Enabled = false
wait(.1)
script.Parent.UpRight.TargetPosition = 0.5 ------------- .2
script.Parent.UpLeft.TargetPosition = 0.5
wait(0.3)
script.Parent.UpLeft.Enabled = true
script.Parent.AcrossLeft.Enabled = false
else
wait(3.5)
script.Parent.AcrossLeft.TargetPosition = 4
script.Parent.AcrossRight.TargetPosition = 4
wait(2.5)
script.Parent.UpLeft.Enabled = true
script.Parent.UpRight.Enabled = true
script.Parent.AcrossLeft.Enabled = false
script.Parent.AcrossRight.Enabled = false
wait(.1)
script.Parent.UpLeft.TargetPosition = 0.5
script.Parent.UpRight.TargetPosition = 0.5
end
end
end)
script.Parent.Parent.Parent.Parent.LeftDoor.Changed:Connect(function()
if script.Parent.Parent.Parent.Parent.LeftDoor.Value == true then
--script.Parent.Trigger.ProximityPrompt.Enabled = true
script.Parent.Open.Value = true
else
script.Parent.Trigger.ProximityPrompt.Enabled = false
script.Parent.Open.Value = false
end
end)
script.Parent.Trigger.ProximityPrompt.Triggered:Connect(function()
script.Parent.Trigger.ProximityPrompt.Enabled = false
script.Parent.Open.Value = true
end)