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 do I make the gun to damage people?

Previous Thread :: Next Thread 
mertes is not online. mertes
Joined: 30 Apr 2010
Total Posts: 1253
30 Dec 2012 07:07 AM
I did this on building helpers, but I guess I need to script for this! Anyway, I know the basics of scripting, but how do I script so it deals damage to people, I made a gun some days ago, and I tested it on a friend, but he didn't be damaged of it, I need help!
Report Abuse
ZDude2461 is not online. ZDude2461
Joined: 26 Apr 2009
Total Posts: 347
30 Dec 2012 07:14 AM
You just need a damage script to be cloned into the bullet when you fire.
Something simple like an onTouched take damage thingy.
Report Abuse
joachimh is not online. joachimh
Joined: 11 May 2011
Total Posts: 6
30 Dec 2012 07:19 AM
Well. This is a script I made some months ago, it's very original since many use it, and I've checked, it works!

ball = script.Parent
damage = 55



function onTouched(hit)
local humanoid = hit.Parent:findFirstChild("Humanoid")


if humanoid ~= nil then
tagHumanoid(humanoid)
humanoid.Health = humanoid.Health - damage
wait(.5)
untagHumanoid(humanoid)
end

connection:disconnect()
ball.Parent = nil
end

function tagHumanoid(humanoid)
-- todo: make tag expire
local tag = ball:findFirstChild("creator")
if tag ~= nil then
local new_tag = tag:clone()
new_tag.Parent = humanoid
end
end


function untagHumanoid(humanoid)
if humanoid ~= nil then
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
tag.Parent = nil
end
end
end

connection = ball.Touched:connect(onTouched)

wait(1)
ball.Parent = nil
Report Abuse
mertes is not online. mertes
Joined: 30 Apr 2010
Total Posts: 1253
30 Dec 2012 07:20 AM
Thanks Joachim, I'll try it out.
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