#Help plss

1 messages · Page 1 of 1 (latest)

fossil trench
#

Script

#

mention if u can fix it

fossil trench
#

well, when a player dies, i want the game detect which team is the player: Red or Blue. If its Blue and he died, gives a point for RedScore. if its Red and he died, gives a point for BlueScore.

#

@wary forge

wary forge
fossil trench
#

yes, it is in my script, but isnt working :/

wary forge
fossil trench
#

local function handle_death(player)
local leaderstats = player:FindFirstChild("leaderstats")
if not leaderstats or not player.Team then return end

if player.Team.Name == "Blue" then
    -- PUNTO PARA ROJO
    for _, p in ipairs(Players:GetPlayers()) do
        local ls = p:FindFirstChild("leaderstats")
        if ls then
            local Red = ls:FindFirstChild(RedStatName)
            if Red then Red.Value += 1 end
        end
    end
    print(player.Name .. " died. Point for red.")
elseif player.Team.Name == "Red" then
    -- PUNTO PARA AZUL
    for _, p in ipairs(Players:GetPlayers()) do
        local ls = p:FindFirstChild("leaderstats")
        if ls then
            local Blue = ls:FindFirstChild(BlueStatName)
            if Blue then Blue.Value += 1 end
        end
    end
    print(player.Name .. " died. Point for blue.")
end and more later in the script: local function handle_character_added(character)
    local humanoid = character:WaitForChild("Humanoid")
    local died = false
    humanoid.Died:Connect(function()
        if died then return end
        died = true
        handle_death(player)
    end)
end
#

here is

wary forge
#
local function handledeath(player)
    local leaderstats = player:FindFirstChild("leaderstats")
    if not leaderstats or not player.Team then return end

    if player.Team.Name == "Blue" then
        -- PUNTO PARA ROJO
        for , p in ipairs(Players:GetPlayers()) do
            local ls = p:FindFirstChild("leaderstats")
            if ls then
                local Red = ls:FindFirstChild(RedStatName)
                if Red then Red.Value += 1 end
            end
        end
        print(player.Name .. " died. Point for red.")
    elseif player.Team.Name == "Red" then
        -- PUNTO PARA AZUL
        for _, p in ipairs(Players:GetPlayers()) do
            local ls = p:FindFirstChild("leaderstats")
            if ls then
                local Blue = ls:FindFirstChild(BlueStatName)
                if Blue then Blue.Value += 1 end
            end
        end
        print(player.Name .. " died. Point for blue.")
    end and more later in the script: local function handle_character_added(character)
        local humanoid = character:WaitForChild("Humanoid")
        local died = false
        humanoid.Died:Connect(function()
            if died then return end
            died = true
            handle_death(player)
        end)
    end
fossil trench
#

fixed?

wary forge
#

send that block of code please.

fossil trench
#

local function handle_death(player)
local leaderstats = player:FindFirstChild("leaderstats")
if not leaderstats or not player.Team then return end

if player.Team.Name == "Blue" then
    -- PUNTO PARA ROJO
    for _, p in ipairs(Players:GetPlayers()) do
        local ls = p:FindFirstChild("leaderstats")
        if ls then
            local Red = ls:FindFirstChild(RedStatName)
            if Red then Red.Value += 1 end
        end
    end
    print(player.Name .. " died. Point for red.")
elseif player.Team.Name == "Red" then
    -- PUNTO PARA AZUL
    for _, p in ipairs(Players:GetPlayers()) do
        local ls = p:FindFirstChild("leaderstats")
        if ls then
            local Blue = ls:FindFirstChild(BlueStatName)
            if Blue then Blue.Value += 1 end
        end
    end
    print(player.Name .. " died. Point for blue.")
end
wary forge
fossil trench
#

a mb

#

im spanish

#

wait

#

local function handle_character_added(character)
local humanoid = character:WaitForChild("Humanoid")
local died = false
humanoid.Died:Connect(function()
if died then return end
died = true
handle_death(player)
end)
end i thing here

woeful vigil
fossil trench
#

Buenos días