Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local minPart = workspace.min
- local maxPart = workspace.max
- local partToCheck = workspace.CheckPart
- local minPos = minPart.Position
- local maxPos = maxPart.Position
- function betweenAxis(axis, axisMin, axisMax)
- return (axis > axisMin) and (axis < axisMax)
- end
- function inbetweenPos(pos, min, max)
- local posx, minx, maxx = pos.X, min.X, max.X
- local posy, miny, maxy = pos.Y, min.Y, max.Y
- local posz, minz, maxz = pos.Z, min.Z, max.Z
- return betweenAxis(posx, minx, maxx) and betweenAxis(posy, miny, maxy) and betweenAxis(posz, minz, maxz)
- end
- while true do
- local pos = partToCheck.Position
- if inbetweenPos(pos, minPos, maxPos) then
- partToCheck.BrickColor = BrickColor.Green()
- else
- partToCheck.BrickColor = BrickColor.Red()
- end
- wait()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement