mark11101
|
  |
| Joined: 11 May 2012 |
| Total Posts: 53 |
|
|
| 03 Sep 2017 11:17 AM |
| I was looking through the roblox api wiki but I'm sorta new to scripting and cannot figure this out. I want to make it where when a player gets to close to a block (the sun in my case) to damage them. I'm gonna assume ill need the size of the sun as a variable then the range from the edge of it I wish players to take damage and how much damage but I have no clue how to make the script figure out if a player is in range of the sun... |
|
|
| Report Abuse |
|
|
mark11101
|
  |
| Joined: 11 May 2012 |
| Total Posts: 53 |
|
| |
|
|
| 03 Sep 2017 11:23 AM |
distance = (sun.Position-player.HumanoidRootPart.Position).magnitude if distance < SomeNumber then --damage end
If you want to go from the edge of the sun, given that it is a sphere this is easy: just subtract the radius from SomeNumber. |
|
|
| Report Abuse |
|
|
mark11101
|
  |
| Joined: 11 May 2012 |
| Total Posts: 53 |
|
| |
|