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

Help With Damage Script?

Asked by
Scootakip 299 Moderation Voter
8 years ago
local debounce = true
function ot(part)
    local humanoid = part.Parent:FindFirstChild()
    if humanoid ~= nil then
        if game.Players:GetPlayerFromCharacter(humanoid.Parent).TeamColor == BrickColor.new("Bright blue") then
            if debounce == true then
            humanoid:TakeDamage(50)
            debounce = false
            end
        end
    end
end

script.Parent.Touched:connect(ot)

This script is supposed to have someone take 50 damage when they touch this, only if they're on the Bright blue team. It doesn't work. Some help?

2 answers

Log in to vote
4
Answered by
XAXA 1569 Moderation Voter
8 years ago

Line 3:

local humanoid = part.Parent:FindFirstChild("Humanoid")

Ad
Log in to vote
1
Answered by
rexbit 707 Moderation Voter
8 years ago

You forgot to place Humanoid on lines 03 in the FindFirstChild method.

local humanoid = part.Parent:FindFirstChild("Humanoid")

Answer this question