Checking part position

Hello, so I’m making some super simple placement system, but I need to make a maximum position the part can go on to fit on the plot.

When I try and get the part’s position I get a ‘attempt to call a table value’.

I know there’s a few posts about this but all the solutions seem too complex for such a simple thing.

-- This using just Vector3 gives the error mentioned
if movePart.Position == Vector3(9.151, 3.499, -54.69) then
	print("bounds reached")
end

-- This just flat out doesn't work, or even give an error in output
if movePart.Position == Vector3.new(9.151, 3.499, -54.69) then
	print("bounds reached")
end

I want to use position for datastore to save and load positions.

Any help or advice would be highly appreciated.

Use movePart.CFrame == CFrame.new(9.151,3.499, -54.69)
You should use the CFrame instead of Vector3.

It’s probably not working since positions can slightly differ, you probably have to check each coordinate and check if their equal or greater/lower depending on what you need

1 Like

I’ll use Cframe for now on. Still get the exact error I was getting with Vector3 however.

Make sure you have .new also @EmbatTheHybrid Could be right as the position could slightly alter, I would recommend printing out the Current Position of the part to see where it is, that way you can iterate them values into you the if statement.

Super odd. I cant get this to work. I’ve checked the position of the part and even changed it to the point of activation but it still doesn’t work.

	if movePart.CFrame == CFrame.new(movePart.Position.X,movePart.Position.Y, -54.69) then
		print("bound",movePart.Position)
	end

So what is the script meant to do exactly? Is meant to keep a players builds inside there plot? The way your doing it doesn’t seem like it would work.

Yeah that’s what I’m doing. What would recommend I do otherwise?

This is a really good post. Theres a part in which he gets the Canvas. I too am trying to make a placing system for my game, and I will most likely follow this tutorial. Sorry that I can’t find a specific answer for you.

No problem man. Thanks for the help anyways.