I made a guis that let players change their team, but I am stuck at let them spawn at a specific location if they select the team.
player = game.Players.LocalPlayer if player.MouseButtonClick.script.Parent then -- stucking at here.
First we have to get the player's character. We can do this by doing
local player = game.Players.LocalPlayer local character = player.Character
However, we probably want to wait for the character. We can make sure the Character has loaded by doing this,
local player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:wait()
Now we can get the Torso,
local player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:wait() local torso = character:WaitForChild("Torso")
You can use this at any time during the script. Just CFrame the torso to whatever position you would like. Example,
Torso.CFrame = CFrame.new(0,50,0)
Or you can teleport them to a part,
local part = workspace.Part Torso.CFrame = part.CFrame
Good Luck!
I think you can do this turn on the AllowTeamChangeOnTouch when a gui gets clicked or brick and when they get tped to the spawn make a ontouch script turning AllowTeamChangeOnTouch false
OnTouch for spawnpoint thing
game.Teams.TeamName.AllowTeamChangeOnTouch = false
For brick to tp
game.Teams.TeamName.AllowTeamChangeOnTouch = true
and make a teleport script to the spawns position