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!
01 | TweenService = game:GetService( "TweenService" ) |
02 |
03 | script.Parent.Open.Changed:Connect( function () |
04 | if script.Parent.Lockdown.Value = = false then |
05 | if script.Parent.Open.Value = = true then |
06 | local Info = TweenInfo.new( 0.1 , Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, 0 , false , 0 ) |
07 | TweenService:Create(script.Parent.Door.PrimaryPart, Info, { CFrame = script.Parent.Positions.Opened.CFrame } ):Play() |
08 | script.Parent.Door.PrimaryPart.OpenClose:Play() |
09 |
10 | elseif script.Parent.Open.Value = = false then |
11 | local Info = TweenInfo.new( 11 , Enum.EasingStyle.Bounce, Enum.EasingDirection.Out, 0 , false , 0 ) |
12 | TweenService:Create(script.Parent.Door.PrimaryPart, Info, { CFrame = script.Parent.Positions.Closed.CFrame } ):Play() |
13 | script.Parent.Door.PrimaryPart.OpenClose:Play() |
14 | wait( 0.8 ) |
15 |
I'm not entirely sure what the issue is because I cant see the hierarchy, but my best guess is theres no primary part or this door object is null, perhaps its cancollide off and anchored false? I don't know, but the "instance is null" error is usually caused by something that is nonexistant or has been deleted. Good luck and I hope you find a proper answer soon!