Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago

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

Log in to vote
0
Answered by
dispeller 200 Moderation Voter
6 years ago
Edited 6 years ago

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

Ad

Answer this question