Hello, I am trying to have a door that can open and close. However, whenever the function runs, it doesn’t work and gives me this output error: Unable to cast to Dictionary - Server - ELEVATOR:29
Here is the code for the door:
function door(oc)
if oc == false then
local tweenright = tweenservice:Create(elevator.RightDoor, tween, Vector3.new(4, 0, 0))
local tweenleft = tweenservice:Create(elevator.LeftDoor, tween, Vector3.new(-4, 0, 0))
tweenright:Play()
tweenleft:Play()
else
local tweenright = tweenservice:Create(elevator.RightDoor, tween, Vector3.new(-4, 0, 0)) -- problem line
local tweenleft = tweenservice:Create(elevator.LeftDoor, tween, Vector3.new(4, 0, 0))
tweenright:Play()
tweenleft:Play()
end
end
TweenInfo:
local tween = TweenInfo.new(
1, -- Time
Enum.EasingStyle.Sine, -- EasingStyle
Enum.EasingDirection.Out, -- EasingDirection
0, -- RepeatCount (when less than zero the tween will loop indefinitely)
false, -- Reverses (tween will reverse once reaching it's goal)
0 -- DelayTime
)
I haven’t really tried much, but I don’t know what to do.