I'm trying to make a button that closes a door on press. However, whenever I run my code, I get the error on line 9. This is my code thus far:
local switch = script.Parent
local switched = script.Parent:WaitForChild("Switched")
local TS = game:GetService("TweenService")
local LD = workspace.LeftDoor
local goal = {}
local TInfo = TweenInfo.new(1)
while true do
switched:GetPropertyChangedSignal():Wait()
if switched.Value then
goal.Position = Vector3.new(-10.125, 2.5, -3.125)
TS:Create(LD, goal, TweenInfo.new(0.3)):Play()
goal.Position = Vector3.new(-14.125, 3.625, 7)
TS:Create(LD, goal, TInfo):Play()
end
end
P.S. My code isn't complete, I will finish it once I'm past this roadblock.
