How to teleport back and forth??
Okay, so let me explain what I wanted. And what the problem is, before I present the script.
Okay so I made a gui with a text button. And it is supposed to take you from the lobby to the game, then after it does the text changes from "Game" to "Lobby", and when you click it again it is supposed to take you back to the lobby, then repeat this.
The problem is that when you click it takes you to the game, then text changes to "Lobby" but when you click, it doesn't take you to the lobby part
I am using the positions of the parts and idk if it is how I am doing it or not. And I am wondering how will I make it repeat? I've been working on it for a while, and I'd appreciate if anyone has a idea or clue how to fix this? Or make it better??
SCRIPT
03 | game.Players.LocalPlayer.PlayerGui.ScreenGui.TextButton.Text = ( "Game" ) |
04 | script.Parent.MouseButton 1 Click:Connect( function () |
05 | game.Players.LocalPlayer.character.Torso.CFrame = CFrame.new(workspace.gameT.position) |
06 | if ingame = = false then |
08 | game.Players.LocalPlayer.PlayerGui.ScreenGui.TextButton.Text = ( "Lobby" ) |
09 | script.Parent.MouseButton 1 Click:Connect( function () |
10 | game.Players.LocalPlayer.character.Torso.CFrame = CFrame.new(workspace.lobbyT.Position) |
here is a gif of what happens too btw: https://gyazo.com/11489be121de4cff760bfb71b6a9d695