I'm trying to make it where the player returns to the "lobby". Meaning they need to change team to "lobby" and then reset so they spawn back. I've tried multiple times but they never work. Here is the code I'm currently using for the button:
local plr = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
plr.Team = "Lobby"
plr.TeamColor = "Dark stone grey"
plr.Health = 0
end)
(I have a feeling that I'm not defining/calling the player correctly)
Here's the code I tried using a method from this site:
local plr = game.Players.LocalPlayer.Name
repeat wait() until plr.Character
local chr = plr.Character
local hum = chr:WaitForChild("Humanoid")
script.Parent.MouseButton1Click:Connect(function()
plr.Team = "Lobby"
plr.TeamColor = "Dark stone grey"
hum.Health = 0
end)

2 comments
Is this in a LocalScript? Oh, and the second script won't work. Stick to the first one.
this is a localscript