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
 

My TakeDamage() script isn't working?

Previous Thread :: Next Thread 
Motioning is not online. Motioning
Joined: 25 Aug 2012
Total Posts: 254
07 May 2015 03:45 PM
So i'm using this sword from roblox battle, and i'm trying to make it only attack a dummy a made. This is so you can't kill other players in the lobby. The dummy's name is Dummy. I don't get a error, it just doesn't do anything to the dummy. Help?

These are only parts of the script, not the full thing.

handle.Touched:connect(function(hit)
if equipped and character and humanoid and humanoid.Health > 0 and humanoid.Name == "Dummy" and not hit:isDescendantOf(character) then
local targethumanoid = hit.Parent:FindFirstChild("Humanoid")
if targethumanoid and targethumanoid.Health > 0 and not hithumanoids[targethumanoid] then
hithumanoids[targethumanoid] = true

for _, v in pairs(targethumanoid:GetChildren()) do
if v and v.Name == "creator" then
v:remove()
end
end
local tag = Instance.new("ObjectValue")
tag.Name = "creator"
tag.Value = player
debris:AddItem(tag, 3)
tag.Parent = targethumanoid

local damagemultiplier = 1

targethumanoid:TakeDamage(damage * (combo + 1) * damagemultiplier)
end
end
end)

tool.Equipped:connect(function()
equipped = true
lastclick = tick()
combo = 0
character = tool.Parent
player = game.Players:GetPlayerFromCharacter(character)
humanoid = character:FindFirstChild("Humanoid")
if humanoid then
humanoid.WalkSpeed = 16 * speedboost
else
character = nil
end
end)


gr8 b8 m8 r8=8/8
Report Abuse
Motioning is not online. Motioning
Joined: 25 Aug 2012
Total Posts: 254
07 May 2015 03:52 PM
bump


gr8 b8 m8 r8=8/8
Report Abuse
Motioning is not online. Motioning
Joined: 25 Aug 2012
Total Posts: 254
07 May 2015 03:55 PM
bump2


gr8 b8 m8 r8=8/8
Report Abuse
Motioning is not online. Motioning
Joined: 25 Aug 2012
Total Posts: 254
07 May 2015 03:58 PM
bump3


gr8 b8 m8 r8=8/8
Report Abuse
juniorjfive is not online. juniorjfive
Joined: 05 Jan 2010
Total Posts: 671
07 May 2015 04:46 PM
the TakeDamage() function doesn't work for Dummys, only for the Players.

Just subtract the health by the damage dealth.

targethumanoid.Health = targetHumanoid.Health - (damage * (combo + 1) * damagemultiplier)
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