johnbon1
|
  |
| Joined: 01 Feb 2014 |
| Total Posts: 173 |
|
|
| 30 Sep 2014 08:10 PM |
ok so I got a kill script to work but it makes the bullet like go through people sometimes and in general the bullet doesn't always kill when it hits. this part of the script is the problem because the problem is not there when this part is gone. can anybody explain why this would affect a bullet?
ball = script.Parent function onTouched(hit) local humanoid = hit.Parent:findFirstChild("Humanoid")
if humanoid ~= nil then tagHumanoid(humanoid) humanoid.Health = humanoid.Health - damage wait(2) 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 |
|
|
johnbon1
|
  |
| Joined: 01 Feb 2014 |
| Total Posts: 173 |
|
| |
|
johnbon1
|
  |
| Joined: 01 Feb 2014 |
| Total Posts: 173 |
|
| |
|
johnbon1
|
  |
| Joined: 01 Feb 2014 |
| Total Posts: 173 |
|
| |
|
|
| 01 Oct 2014 10:27 AM |
| "humanoid.Health = humanoid.Health - damage" tries to subtract the damage variable from humanoid, and the variable "damage" isnt defined, so add local damage = 20(or any other) |
|
|
| Report Abuse |
|
|
johnbon1
|
  |
| Joined: 01 Feb 2014 |
| Total Posts: 173 |
|
|
| 02 Oct 2014 04:51 PM |
so I changed your quote from the original script to...
humanoid.Health = humanoid.Health - local damage = 100
however local is underlined in read, did I add it correctly?
if not sorry I am not an amazing scripter lol. |
|
|
| Report Abuse |
|
|
johnbon1
|
  |
| Joined: 01 Feb 2014 |
| Total Posts: 173 |
|
|
| 02 Oct 2014 05:04 PM |
oh, I hadn't included the full part of the script.. let me repost:
local db = false
script.Parent.Touched:connect(function(h) if db then return end db = true local hum = h.Parent:FindFirstChild("Humanoid") if hum then h.Parent:BreakJoints() end db = false end)
ball = script.Parent function onTouched(hit) local humanoid = hit.Parent:findFirstChild("Humanoid")
if humanoid ~= nil then tagHumanoid(humanoid) humanoid.Health = humanoid.Health - damage wait(2) 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 |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 02 Oct 2014 05:08 PM |
Keep your script, but all the way at the top add local damage = 100 |
|
|
| Report Abuse |
|
|
johnbon1
|
  |
| Joined: 01 Feb 2014 |
| Total Posts: 173 |
|
| |
|
johnbon1
|
  |
| Joined: 01 Feb 2014 |
| Total Posts: 173 |
|
|
| 02 Oct 2014 05:32 PM |
| it still seems to cause the script to make a bullet just go through a person comparative to the script without the bottom part where it doesn't go through people and quite literally breaks joints as the script dictates (afaik) |
|
|
| Report Abuse |
|
|
|
| 02 Oct 2014 05:38 PM |
| idk man but here is a free bumb |
|
|
| Report Abuse |
|
|
| |
|
johnbon1
|
  |
| Joined: 01 Feb 2014 |
| Total Posts: 173 |
|
| |
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 02 Oct 2014 06:01 PM |
| It's easily fixed by like, not using a bullet and instead resorting to hitscan/raycasting |
|
|
| Report Abuse |
|
|
johnbon1
|
  |
| Joined: 01 Feb 2014 |
| Total Posts: 173 |
|
|
| 02 Oct 2014 06:03 PM |
| no earthly idea what that even is |
|
|
| Report Abuse |
|
|
| |
|
johnbon1
|
  |
| Joined: 01 Feb 2014 |
| Total Posts: 173 |
|
| |
|
| |
|
johnbon1
|
  |
| Joined: 01 Feb 2014 |
| Total Posts: 173 |
|
| |
|