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

[EOF error] Team change on death?

Asked by 4 years ago
while true do
game:GetService('Players').PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        character:WaitForChild("Humanoid").Died:Connect(function()
print(Player.Team.Name)
if Player.Team.Name == Blue then
Player.Team.Name = Red
else
Player.Team.Name = Blue
wait(0.5)
end
end

It just gives me an EOF error in the output.

It prints the name and if the team is blue then change it to red , vice versa.

1 answer

Log in to vote
4
Answered by
NotedAPI 810 Moderation Voter
4 years ago
Edited 4 years ago

Hello, RebornedSnoop!

The reason it was giving you some errors was because you messed up some of the ends. Also, when assigning a player to a team your suppose to put the team name in quotes (you will see that in this script). Also your while loop isn't needed so I removed it.

If you come across any errors feel free to reply to this and let me know!

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        character:WaitForChild("Humanoid").Died:Connect(function()
            print(player.Team.Name)
            if player.Team.Name == "Blue" then
                player.Team = game.Teams:WaitForChild("Red")
                print(player.Team.Name)
            else
                player.Team = game.Teams:WaitForChild("Blue")
                print(player.Team.Name)
                wait(0.5)
            end
        end)
    end)
end)
Ad

Answer this question