I have a simple tween script for a door I'm working on and it's giving me an error, but I do not know why. Any help is appreciated!
TweenService = game:GetService("TweenService")
script.Parent.Open.Changed:Connect(function()
if script.Parent.Lockdown.Value == false then
if script.Parent.Open.Value == true then
local Info = TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, 0, false, 0)
TweenService:Create(script.Parent.Door.PrimaryPart, Info, {CFrame = script.Parent.Positions.Opened.CFrame}):Play()
script.Parent.Door.PrimaryPart.OpenClose:Play()
elseif script.Parent.Open.Value == false then
local Info = TweenInfo.new(11, Enum.EasingStyle.Bounce, Enum.EasingDirection.Out, 0, false, 0)
TweenService:Create(script.Parent.Door.PrimaryPart, Info, {CFrame = script.Parent.Positions.Closed.CFrame}):Play()
script.Parent.Door.PrimaryPart.OpenClose:Play()
wait(0.8)
elseif script.Parent.Lockdown.Value == true then
if script.Parent.Open.Value == true then
local Info = TweenInfo.new(0.01, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, 0, false, 0)
TweenService:Create(script.Parent.Door.PrimaryPart, Info, {CFrame = script.Parent.Positions.Opened.CFrame}):Play()
script.Parent.Door.PrimaryPart.OpenClose:Play()
script.Parent.Lockdown.Value = false
elseif script.Parent.Open.Value == false then
local Info = TweenInfo.new(.1, Enum.EasingStyle.Bounce, Enum.EasingDirection.Out, 0, false, 0)
TweenService:Create(script.Parent.Door.PrimaryPart, Info, {CFrame = script.Parent.Positions.Closed.CFrame}):Play()
script.Parent.Door.PrimaryPart.EmergencyClose:Play()
script.Parent.Lockdown.Value = false
wait(0.8)
end
end
end
end)

1 comment
Thank you! I just noticed there was no primary part!