Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can i make to spawn at specific location if i select the team?

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. 

2 answers

✓ Accepted answer

To teleport a player, simple set the Position/CFrame of the character's Torso.

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")

How to teleport characters,

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

Side Note,

Your question was confusing and broad. Sorry if I couldn't answer more clearly

Good Luck!

If I helped, please don't forget to accept my answer.

2 comments

0

Oh thanks and sorry for my confusing question

0

I should add this method only works in a Local Script.

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

4 comments

0

can u just give me a full answer..

0

no the funny thing is you HAVE nothing done so your just asking for a WHOLE SCRIPT for your game

0

:P u just said AllowTeamChangeOnTouch and i have done 2 lines of script

0

This is an okay answer. I don't know what you're really asking tho :/

This discussion is preserved as it was. New answers, comments, and votes are closed.