So I'm trying to make have a button that skips a stage and I don't know how to do it. I made the stage names 1 2 3 4. I'm trying to convert them to an int and add one to them and then back to a string.
TextButton.MouseButton1Up:Connect(function()
local player = game.Players.LocalPlayer
local teamname = player.Team.Name
local teamnumber = tonumber(teamname)
local newteam = tostring(teamnumber + 1)
print(newteam)
print(player.Team.Name)
player.Team = game.Teams[newteam]
print(player.Team.Name)
player.Character.Humanoid.Health = 0
end)
I doesn't update and I always respawn on the stage I was on. But when I look at the player information, it says I am on the next stage when I don't respawn there. Also, how do I respawn the player without killing them?

3 comments
Well, if you're going to change the team, don't do it on the client. The server won't read the change.
Also, just teleport the player to the spawn location if you don't want to kill them. You can also mess around with their forcefield if you want to keep it or change it.
how do I do it on the client side? do I put a script in the player scripts so that when that GUI is clicked, the team changes?