Twala
|
  |
| Joined: 01 Nov 2008 |
| Total Posts: 6799 |
|
|
| 12 May 2012 06:23 PM |
Hello.
This script is supposed to make it so when the arrow (Script is inside Arrow) Hits a target, it either damages if a Humanoid, of lodges into it.
Everything works fine. The thing that isn't working is the part that says if it hits your Head, it does 100 damage instead of 50, and the Shooter gets a badge.
Instead, if you hit someone in the head, it only does 50 Damage, and no badge. I think its a problem with the end placement, PLEASE HELP!
local arrow = script.Parent
local damage = 50 local deb = false
local weld = Instance.new("Weld") weld.Part0 = arrow weld.Parent = arrow
function onTouch(hit) if hit.Parent then vChar = hit.Parent humanoid = vChar:FindFirstChild("Humanoid") if humanoid and deb == false then deb = true local tag = arrow:FindFirstChild("creator") if tag then tag.Parent = humanoid
end if hit.Name == "Head" then damage = 100 ownr = humanoid:FindFirstChild("creator") if ownr then p = game.Players:FindFirstChild(ownr.Value) if p then b = game:GetService("BadgeService") b:AwardBadge(p.userId, 80690791) end end end humanoid:TakeDamage(damage) weld.Part1 = hit else weld.Part1 = hit weld.C0 = CFrame.new(arrow.Position - hit.Position) end end end
arrow.Touched:connect(onTouch)
wait(2) arrow:Remove() |
|
|
| Report Abuse |
|
|
Twala
|
  |
| Joined: 01 Nov 2008 |
| Total Posts: 6799 |
|
| |
|
|
| 12 May 2012 06:34 PM |
It might be hit.name, lower-case.
Put a print before that if, print("hit = ", hit, hit.name, hit.parnet)
|
|
|
| Report Abuse |
|
|
Twala
|
  |
| Joined: 01 Nov 2008 |
| Total Posts: 6799 |
|
|
| 12 May 2012 06:35 PM |
| Theres no output, so Im guessing I failed on the placement of ends or an if--then is wrong. |
|
|
| Report Abuse |
|
|
|
| 12 May 2012 06:39 PM |
move the Print up to before the first If.
|
|
|
| Report Abuse |
|
|
Twala
|
  |
| Joined: 01 Nov 2008 |
| Total Posts: 6799 |
|
| |
|
zrainfall
|
  |
| Joined: 28 Apr 2012 |
| Total Posts: 129 |
|
|
| 12 May 2012 07:56 PM |
| There's an end that seems to finish the script before time. It's right where there's an enter in the script you posted. |
|
|
| Report Abuse |
|
|
|
| 12 May 2012 08:15 PM |
Buddy,
Your're gonna have to get it to print something, or it's just not getting there.
Open view>output, and read what it says.
|
|
|
| Report Abuse |
|
|