Okay this is a DOUBLE-PROBLEM question. So I have been working on this problem for two weeks now and I can't manage to find any solution on the research that I have gathered. Basically, this is a Team Changer GUI and my problems are:
First problem the teleporter works on sometimes when you pressed the button, but often will find yourself in the same spot.
Second problem the debounce for TeamJoined is not working at ALL.
No errors are given in the output box.
ClassHolder = script.Parent --Frame
ct = ClassHolder.CounterTerrorists --Button
t = ClassHolder.Terrorists --Button
ctspawn = game.Workspace.ctspawn --SpawnPoint 1
tspawn = game.Workspace.tspawn --SpawnPoint 2
player = game.Players.LocalPlayer
Teamjoined = false
ct.MouseButton1Down:connect(function()
if Teamjoined == false then
player.TeamColor = BrickColor.new('Really blue')
player.Character:MoveTo(ctspawn.Position)
player:LoadCharacter()
ClassHolder.Visible = false
Teamjoined = true
elseif Teamjoined == true then
print('You already joined a team')
end
end)
t.MouseButton1Down:connect(function()
if Teamjoined == false then
player.TeamColor = BrickColor.new('Really red')
player.Character:MoveTo(tspawn.Position)
player:LoadCharacter()
ClassHolder.Visible = false
Teamjoined = true
elseif Teamjoined == true then
print('You already joined a team')
end
end)
Thanks for the help.

3 comments
MoveTo will make them walk to the point. Here's a good idea: Change their team, put spawns for that team. Then, use game.Players.PLAYERNAME:LoadCharacter() and it will basically reset the character without the death animation and such, like the respawn command in admin scripts.
And by the above, I mean remove the "moveto" part. Make sure "tspawn" is a spawnlocation of the variety "Really red". To make it debounce just type debounce = true.
@shayner: MoveTo only makes them walk to the specified point if you apply it to a humanoid. In this case, it should work fine since it's being applied to the character model.