|
| 20 Oct 2012 04:19 PM |
I want add a script that turns a brick a different blue after a person goes a certain distance away from another brick.
I know this isn't right, but something along the lines of:
if RealPersian.Distancefrombrick > 40 then brick.Color= BrickColor.new("Blue") end
How can it be done? |
|
|
| Report Abuse |
|
|
|
| 20 Oct 2012 04:22 PM |
Thats funny I just made a script that can do just this (With a little editing) I'll edit it and post it :) |
|
|
| Report Abuse |
|
|
grimm343
|
  |
| Joined: 18 Sep 2008 |
| Total Posts: 2796 |
|
|
| 20 Oct 2012 04:30 PM |
Use .magnitude when subtracting two Vector3 positions.
Example:
print((Wokspace.Part.Position-Workspace.grimm343.Torso.Position).magnitude) |
|
|
| Report Abuse |
|
|
|
| 20 Oct 2012 04:32 PM |
Find = script.Parent.Parent.Name Part = Brick while true do wait(1) if workspace[Find].Torso.Position.X < workspace.Part.Position.X + 10 and workspace[Find].Torso.Position.X > workspace.Part.Position.X - 10 and workspace[Find].Torso.Position.Z < workspace.Part.Position.Z + 10 and workspace[Find].Torso.Position.Z > workspace.Part.Position.Z - 10 then print("Your safe, For now!") wait(1) else workspace.Part.Color = BrickColor.new("Blue") wait(0) end end
Somethings wrong with the part that changes the color, Im not good at that kind of stuff sorry! Just fix the color and it will work
(Put the script in the starterGUI) |
|
|
| Report Abuse |
|
|
Joalmo
|
  |
| Joined: 28 Jun 2009 |
| Total Posts: 1160 |
|
|
| 20 Oct 2012 05:13 PM |
machaelaqz4, that script is wayyy too over-complicated.
distanceBetweenParts = ((Part1.Position) - (Part2.Position)).magnitude |
|
|
| Report Abuse |
|
|