Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

TweenService:Create failed because Instance is null?

Asked by 2 years ago
Edited 2 years ago

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!

01TweenService = game:GetService("TweenService")
02 
03script.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 
View all 33 lines...

1 answer

Log in to vote
0
Answered by 2 years ago

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!

0
Thank you! I just noticed there was no primary part! NascarDriverBurak101 2 — 2y
Ad

Answer this question