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)
the problem is that you used TweenInfo.create() which is not the correct one
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)