Hi, I have a problem where my script just will not kill at all for some reason. There aren't any errors, it registers .Touched, it just will not kill!
Here's the code:
Humanoid = script.Parent:WaitForChild("Humanoid") local debounce = false function award(plr) if not game.BadgeService:UserHasBadgeAsync(plr.UserId, 2124571974) then game.BadgeService:AwardBadge(plr.UserId, 2124571974) end end function onTouch(hit) print(hit) if debounce ~= true then debounce = true local player = game.Players:GetPlayerFromCharacter(hit.Parent) local currentplayer = game.Players:GetPlayerFromCharacter(script.Parent) print(player) print(currentplayer) if player and currentplayer then if hit.Parent.ClassName == "Tool" or hit.Parent.Name == "Handle" then currentplayer.Character:BreakJoints() end if currentplayer.TeamColor == BrickColor.new("Really red") then if player.UserId == 111255307 then award(currentplayer) elseif player.UserId == 424716966 then award(currentplayer) elseif player.UserId == 109352342 then award(currentplayer) end end end end wait(2) debounce = false end if Humanoid.RigType == Enum.HumanoidRigType.R6 then script.Parent:WaitForChild("Torso").Touched:Connect(onTouch) else script.Parent:WaitForChild("UpperTorso").Touched:Connect(onTouch) end while true do wait(0.1) Humanoid.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None end
The most important part is this:
if hit.Parent.ClassName == "Tool" or hit.Parent.Name == "Handle" then currentplayer.Character:BreakJoints() end
I have no idea why this doesn't work. Please help!
If everything else in your script is all good then this should work.
Try doing...
currentplayer.Character.Humanoid.Health = 0
I just decided to rescript and change my badge. Thanks for the help!