Ive been working on working on a team change on death for my game, and i have it working with a button click, but can't figure out how to make it work on death
here is what I have
local plr = script.Parent.Parent.Parent.Parent.Parent.Name
script.Parent.MouseButton1Click:connect(function() game.Players[plr].TeamColor = BrickColor.new("Bright blue") game.Workspace[plr].Humanoid.Health="0" script.Parent.Parent.Parent.Enabled=false end)
Simple.
local player = game.Players.LocalPlayer if not player.Character then player.CharacterAdded:Wait() end local character = player.Character local humanoid = player:FindFirstChild("Humanoid") humanoid.Died:Connect(function() player.TeamColor = BrickColor.new("Bright blue") script:Destroy() --deletes the script so after you change teams it doesnt keep running end)