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: Sword Damage

Previous Thread :: Next Thread 
Kasumo is not online. Kasumo
Joined: 22 Mar 2013
Total Posts: 2467
12 Jan 2014 02:14 PM
I want the sword to take away humanoid's MaxHealth divided by 5 when it is swung, can someone help me implement that?

enabled = true
Tool = script.Parent
local Animations = {
[1] = Tool.RightSlash,
[2] = Tool.LeftSlash,
}
Tool.Activated:connect(function(mouse)
if enabled then
local player = game.Players.LocalPlayer
local huma = player.Character:findFirstChild("Humanoid")
local anim = huma:LoadAnimation(Animations[math.random(1, #Animations)])
wait()
anim:Play()
--[Damage]--
enabled = false
wait(1)
enabled = true
end
end)
Report Abuse
Kasumo is not online. Kasumo
Joined: 22 Mar 2013
Total Posts: 2467
12 Jan 2014 02:31 PM
Bump[1]
Report Abuse
CERE4LKILLER is not online. CERE4LKILLER
Joined: 04 Dec 2011
Total Posts: 138
12 Jan 2014 02:36 PM
the line would be
humanoid.Health = humanoid.Health/5
i can't see the exact code anymore cause of the bump post but you would need to have
local humanoid = hit.Parent:Findfirstchild("Humanoid")--define the humanoid
if humanoid and humanoid.Parent~= script.Parent.Parent--then-verify there is a humanoid and its not the holder


type of thing
Report Abuse
CERE4LKILLER is not online. CERE4LKILLER
Joined: 04 Dec 2011
Total Posts: 138
12 Jan 2014 02:38 PM
o wait it would be
damage = huma.Health/5
Humanoid:TakeDamage(damage)
disregard the previous post
Report Abuse
Kasumo is not online. Kasumo
Joined: 22 Mar 2013
Total Posts: 2467
12 Jan 2014 02:57 PM
The problem with that is, when the player swings, it takes multiple amounts of damage, like it doesn't have a debounce, when it does.
Report Abuse
Kasumo is not online. Kasumo
Joined: 22 Mar 2013
Total Posts: 2467
12 Jan 2014 03:23 PM
Bump[2]
Report Abuse
Kasumo is not online. Kasumo
Joined: 22 Mar 2013
Total Posts: 2467
12 Jan 2014 05:01 PM
Nevermind I fixed it...lazy PEOPLE. >;3
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