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

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

Asked by 4 years ago
Edited 4 years ago

Please encode Lua code in the Lua block code tag (look for the Lua icon in the editor).

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)
0
which line is it? the error marine5575 359 — 4y
0
oops nervermind marine5575 359 — 4y
0
when i click the error it takes me to line 10 maxwilltopyu -13 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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)
0
While yes this did fix the error from earlier now it says (Unable to cast to Dictionary) maxwilltopyu -13 — 4y
0
Here This is the ultimate solution to everything marine5575 359 — 4y
Ad

Answer this question