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

Why is my door saying that position is not part of the model?

Im new to lua coding and I wanted to make a door that works on click so I looked up a tutorial and copied it exactly. 2 hours later I'm sure I have everything the same and his works. the error message i am getting is "position is not part of the model. here is my code

local model = script.Parent.Parent.Parent
local door = model.door 
local value = script.Opened.Value
local close = model.Close
local open = model.Open

script.parent.MouseClick:Connect(function(player)
	if value == false then
		value = true
		door.Position = open.Position
		door.orientation = open.orientation
	elseif value == true then
			 value = false
		door.position = close.position
		door.orientation = close.orientation
			end
end) 

4 comments

0

i have no idea why all the enters went

0

If you put it in a code block it will keep its form

0

I am new to this website how do I do that

0

nvm i got it

1 answer

✓ Accepted answer

That is because Models don't have a position property. If you have a PrimaryPart on the model, then you can use SetPrimaryPartCFrame() on the model. If you don't have a PrimaryPart set, then you could also use MoveTo() on the Model. I recommend that you set a PrimaryPart and use SetPrimaryPartCFrame(). You can read about MoveTo() and SetPrimaryPartCFrame() here and here.

If this helps, then please accept this answer as it helps both of us out :D

1 comment

0

so i am very new to coding could you show me where i would put that

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