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: How would I get the magnitude from a character...

Previous Thread :: Next Thread 
twerq is not online. twerq
Joined: 08 Jun 2013
Total Posts: 1057
22 May 2014 11:45 AM
[ Content Deleted ]
Report Abuse
twerq is not online. twerq
Joined: 08 Jun 2013
Total Posts: 1057
22 May 2014 11:50 AM
[ Content Deleted ]
Report Abuse
Jetta765214 is not online. Jetta765214
Joined: 22 Oct 2008
Total Posts: 1855
22 May 2014 11:58 AM
Easiest way to do this is to use a touch statement, and check the velocity at the time of impact.

Alt. of Jetta765214
Report Abuse
twerq is not online. twerq
Joined: 08 Jun 2013
Total Posts: 1057
22 May 2014 12:24 PM
[ Content Deleted ]
Report Abuse
Trioxide is not online. Trioxide
Joined: 29 Mar 2011
Total Posts: 32902
22 May 2014 12:35 PM
You compare values.
Report Abuse
cooldude999921 is not online. cooldude999921
Joined: 13 Aug 2011
Total Posts: 3702
22 May 2014 12:36 PM
Torso...



get the magnitude from torso
Report Abuse
twerq is not online. twerq
Joined: 08 Jun 2013
Total Posts: 1057
22 May 2014 12:48 PM
[ Content Deleted ]
Report Abuse
twerq is not online. twerq
Joined: 08 Jun 2013
Total Posts: 1057
22 May 2014 02:57 PM
[ Content Deleted ]
Report Abuse
transIate is not online. transIate
Joined: 20 Jun 2013
Total Posts: 2699
22 May 2014 04:26 PM
game.Players.PlayerAdded:connect(function(p)
p.CharacterAdded:connect(function(c)
c.Humanoid.FreeFalling:connect(function()
if((p.torso-workspace['Part')<=17).magnitude then
c:tAkeDamage(3);
break;
end;
end);
end);
end);
Report Abuse
1MangoMan0 is not online. 1MangoMan0
Joined: 28 Sep 2010
Total Posts: 1596
22 May 2014 04:33 PM
I actually made my own fall damage script a while ago. Here, you can have it. Make sure it is a local script inside the starter pack.


death_height = 200
safe_height = 35
min_damage = 5

wait(1)
player = game.Players.LocalPlayer
torso = player.Character:WaitForChild("Torso")
humanoid = player.Character:WaitForChild("Humanoid")

function height()
return torso.Position.y
end
prev_height = height()

humanoid.FreeFalling:connect(function(active)
if active then
start_fall = height()
prev_height = height()
while active do
wait()
if height() > prev_height then
prev_height = height()
end
end
else
fall_length = prev_height - height()
if fall_length > safe_height then
humanoid.Health = humanoid.Health - math.floor(((fall_length - safe_height + min_damage) / death_height) * humanoid.MaxHealth)
end
end
end)
Report Abuse
1MangoMan0 is not online. 1MangoMan0
Joined: 28 Sep 2010
Total Posts: 1596
22 May 2014 04:36 PM
death_height is the height that will kill the player if they fall from that distance. safe_height is how far the player can fall without taking damage. min_damage is the minimum damage dealt to the player when they hit the ground.

This also takes into account the character's max health, so if you were to increase the character's max health but still wanted to do the same percentage of damage (for realism) then there is no problem there.
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