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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 30 Apr 2010 |
| Total Posts: 1253 |
|
|
| 30 Dec 2012 07:20 AM |
| Thanks Joachim, I'll try it out. |
|
|
| Report Abuse |
|
|