generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Damage players in range of a block

Previous Thread :: Next Thread 
mark11101 is online. 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 is online. mark11101
Joined: 11 May 2012
Total Posts: 53
03 Sep 2017 11:22 AM
Dump past spam :/
Report Abuse
BunnyBoy26 is not online. BunnyBoy26
Joined: 17 Jun 2010
Total Posts: 5674
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 is online. mark11101
Joined: 11 May 2012
Total Posts: 53
03 Sep 2017 11:25 AM
Thanks Bunny
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image