Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

When trying to make a swinging door I get the error (attempted to call nil value) How do I fix this?

Whenever I try to make a tween door it gives the the error workspace .doorModel .script :10: attempted to call nil value I can't find a way to fix it. Here's the script.


local doormodel = script.Parent

local tweenservice = game:GetService("TweenService")
local doortweeninfo = TweenInfo.create(
							1, 
							Enum.EasingStyle.Bounce, 
							Enum.EasingDirection.Out, 
							0, 
							false, 
							0
							)
							
local doortween = tweenservice:Create(doormodel.doorclosed, doortweeninfo, (CFrame.new == doormodel.dooropen.CFrame))							
							
doormodel.LockPart.Touched:Connect(function(hit)
	if hit:IsA("Tool") and hit.Parent.Name == "Key" then
		doormodel.LockPart:Destroy()
		doortween:Play()
	end
end)

3 comments

0

which line is it? the error

0

oops nervermind

0

when i click the error it takes me to line 10

1 answer

✓ Accepted answer

Problem

the problem is that you used TweenInfo.create() which is not the correct one

Solution :

The correct one is TweenInfo.new()


local doormodel = script.Parent

local tweenservice = game:GetService("TweenService")
local doortweeninfo = TweenInfo.new( 
                            1, 
                            Enum.EasingStyle.Bounce, 
                            Enum.EasingDirection.Out, 
                            0, 
                            false, 
                            0
                            )

local doortween = tweenservice:Create(doormodel.doorclosed, doortweeninfo, (CFrame.new == doormodel.dooropen.CFrame))                           

doormodel.LockPart.Touched:Connect(function(hit)
    if hit:IsA("Tool") and hit.Parent.Name == "Key" then
        doormodel.LockPart:Destroy()
        doortween:Play()
    end
end)

2 comments

0

While yes this did fix the error from earlier now it says (Unable to cast to Dictionary)

0

Here This is the ultimate solution to everything

This discussion is preserved as it was. New answers, comments, and votes are closed.