I'm trying to change the team of a player, wait a time, then change it back(when a button on a GUI is clicked), but after print-debugging, I've seen that it's not getting past the wait function - it kills the player, puts them into the "Dark stone grey" team, then stops. This is a little frustrating, as I see no reason this would happen. Thank you for all help. Script below:
local button = script.Parent
button.MouseButton1Down:connect(function()
local pToKill = button.Parent.pNameBox.Text
local p = game.Players:FindFirstChild(pToKill)
local char = p.Character
local pTeam = p.TeamColor
print(pTeam)
p.TeamColor = BrickColor.new("Dark stone grey")
char.Humanoid.Health = 0
wait(6)
game.Players:FindFirstChild(pToKill).TeamColor = BrickColor.new(pTeam)
char.Humanoid.Health = 0
print(pTeam)
end)

1 comment
I'm an idiot. Thank you.