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 » Scripting Helpers
Home Search
 

Re: i dont get this :(

Previous Thread :: Next Thread 
YumERAGON is not online. YumERAGON
Joined: 18 Apr 2012
Total Posts: 3893
05 Mar 2014 03:50 PM
local magnitude = (workspace.Part1.Position - workspace.Part2.Position).magnitude
if magnitude >= 5 then
print("hi")
end
Report Abuse
StealthKing95 is not online. StealthKing95
Joined: 13 Dec 2008
Total Posts: 4263
05 Mar 2014 03:56 PM
In this case, the magnitude means the distance between part1 and part2.


So what the code does:

If distance between p1 and p2 is SMALLER THAN or EQUAL to 5 then print hi
Report Abuse
YumERAGON is not online. YumERAGON
Joined: 18 Apr 2012
Total Posts: 3893
05 Mar 2014 03:56 PM
bump can someone explain this to me?
Report Abuse
YumERAGON is not online. YumERAGON
Joined: 18 Apr 2012
Total Posts: 3893
05 Mar 2014 03:57 PM
oooh ok thanks
Report Abuse
YumERAGON is not online. YumERAGON
Joined: 18 Apr 2012
Total Posts: 3893
05 Mar 2014 04:00 PM
and how would i check if the player is in that radius?
Report Abuse
StealthKing95 is not online. StealthKing95
Joined: 13 Dec 2008
Total Posts: 4263
05 Mar 2014 04:02 PM
Hm? What are you asking exactly?

You can use the magnitude between a players torso and a brick but im unsure what you are asking for
Report Abuse
YumERAGON is not online. YumERAGON
Joined: 18 Apr 2012
Total Posts: 3893
05 Mar 2014 04:04 PM
lets say i have a um.. tower that shoots but only if its in a certain distance

thats what im trying to achieve
Report Abuse
StealthKing95 is not online. StealthKing95
Joined: 13 Dec 2008
Total Posts: 4263
05 Mar 2014 04:10 PM
certain distance from what?
Report Abuse
YumERAGON is not online. YumERAGON
Joined: 18 Apr 2012
Total Posts: 3893
05 Mar 2014 04:18 PM
lik ya radius

if the player is in a certain radius then it shoots lemme give it

player + game.Players.LocalPlayer
local magnitude = (workspace.Part1.Position - player.Character.Torso.Position).magnitude
if magnitude <= 5 then
--shoot
end

Would that work?
Report Abuse
YumERAGON is not online. YumERAGON
Joined: 18 Apr 2012
Total Posts: 3893
05 Mar 2014 04:18 PM
player = not + ;€
Report Abuse
StealthKing95 is not online. StealthKing95
Joined: 13 Dec 2008
Total Posts: 4263
06 Mar 2014 10:43 AM
yes
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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