Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 8 years ago

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

Log in to vote
0
Answered by 8 years ago

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.
0
Oh thanks and sorry for my confusing question Scripter_Blan 25 — 8y
0
I should add this method only works in a Local Script. User#11440 120 — 8y
Ad
Log in to vote
1
Answered by 8 years ago

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

0
can u just give me a full answer.. Scripter_Blan 25 — 8y
0
no the funny thing is you HAVE nothing done so your just asking for a WHOLE SCRIPT for your game GimmeWaffleBruh 18 — 8y
0
:P u just said AllowTeamChangeOnTouch and i have done 2 lines of script Scripter_Blan 25 — 8y
0
This is an okay answer. I don't know what you're really asking tho :/ User#11440 120 — 8y

Answer this question