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

How do I let a script know when a part is in specific location?

please how do I stop a part in specific position or make a it destroy in specific position or make its slow in specific position? do I have to use body velocity or use normal script to move it because I have now idea

1 answer

✓ Accepted answer

There are many ways to do this.

One easy to understand way you could do it is by using a loop and checking the cords.

Part = Instance.new("Part",workspace)

while wait() do
	local Pos = Part.Position
	if (Pos.X < 5) and (Pos.X > -5) and (Pos.Z < 5) and (Pos.Z > -5) then
		Part.BrickColor = BrickColor.new("Lime green")
	else
		Part.BrickColor = BrickColor.new("Really red")
	end
end

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