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

Why won't Humanoid:Died() work correctly? (Solved)

Asked by 4 years ago
Edited 4 years ago

Edit: Nevermind I just added a CharacterAdded function and it worked

I have a script that reduces a number value once a user dies. It worked fine until I tried to add a line of code that would also change their team once they died. Now the script doesn't seem to be working at all. Here's what it looks like:

game.Players.PlayerAdded:Connect(function(p)
    wait(1)

p.Character.Humanoid.Died:Connect(function()
    if p.Team ~= game.Teams.Choosing then
    p.Team = game.Teams.Choosing
    game.ServerScriptService.CoreScripts.CoreValues.PlayersLeft.Value = game.ServerScriptService.CoreScripts.CoreValues.PlayersLeft.Value - 1
    end
    end)
end)
1
The player's Team must be Choosing if it isn't working. DeceptiveCaster 3761 — 4y
0
Should also be noted that Humanoid:Died() isnt a method of the humanoid. Although in your code you did use the event, so Im not sure where you were going with there haha. Psudar 882 — 4y

Answer this question