Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My TakeDamage() script isn't working?

Asked by
Relatch 550 Moderation Voter
9 years ago

So'm i'm using this sword from roblox battle, and i'm trying to make it only attack a dummy a made. This is so you can't kill other players in the lobby. The dummy's name is Dummy. I don't get a error, it just doesn't do anything to the dummy. Help?

This is only a part of the script, not the full thing.

handle.Touched:connect(function(hit)
    if equipped and character and humanoid and humanoid.Health > 0 and humanoid.Name == "Dummy" and not hit:isDescendantOf(character) then
        local targethumanoid = hit.Parent:FindFirstChild("Humanoid")
        if targethumanoid and targethumanoid.Health > 0 and not hithumanoids[targethumanoid] then
            hithumanoids[targethumanoid] = true

            for _, v in pairs(targethumanoid:GetChildren()) do
                if v and v.Name == "creator" then
                    v:remove()
                end
            end
            local tag = Instance.new("ObjectValue")
            tag.Name = "creator"
            tag.Value = player
            debris:AddItem(tag, 3)
            tag.Parent = targethumanoid

            local damagemultiplier = 1

            targethumanoid:TakeDamage(damage * (combo + 1) * damagemultiplier)
        end
    end
end)
0
I attempted to do so at line 2, it's a long line. Relatch 550 — 9y
0
Where is `humanoid` and `character` and `equipped`, etc, defined? BlueTaslem 18071 — 9y

1 answer

Log in to vote
0
Answered by
Relatch 550 Moderation Voter
9 years ago

@BlueTaslem

tool.Equipped:connect(function()
    equipped = true
    lastclick = tick()
    combo = 0
    character = tool.Parent
    player = game.Players:GetPlayerFromCharacter(character)
    humanoid = character:FindFirstChild("Humanoid")
    if humanoid then
        humanoid.WalkSpeed = 16 * speedboost
    else
        character = nil
    end
end)
0
I don't think BlueTaslem uses roblox tbh. Vlatkovski 320 — 9y
Ad

Answer this question