#CFrame tween table for a door isn't working

1 messages · Page 1 of 1 (latest)

half willow
#

I'm making a tween door and the PropertyTable isn't working. I keep getting an error in lines 23 and 33: "attempt to index nil with 'CFrame". I swear this worked all the time but I haven't scripted for a while so maybe things have changed. Am I doing something wrong?

mystic stag
#

Make sure you actually have the part before trying to change its properties

#

What you can do to fix this is to wait for the part.

#

So you could do this to safely guard against errors, and to have it tell you if it couldn’t find the part:

local hinge = (pathToYourModel)
if not hinge and typeof(hinge) ~= “model” then
warn(“Hinge not found!”)
return
end

— if the script gets to this point then we KNOW hinge is there AND is a model

— add your other code below

half willow
#

Ohhh! I see the issue, I tried doing something else where I had it as the primary part but then I got rid of it and forgot to change it. That’s why it wasn’t getting the part, Thanks!

mystic stag
#

no prob

#

btw, in the future, just for clarity, I reccomend getting the exact path of the object, rather than just a huge script.parent.parent tree

#

instead of working up the path, work down