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

How could I make a teleport script based on their team?

https://puu.sh/FTbqr.png

The blue should be a teleporter if stepped on. The yellow should be where the players should be teleported to. My only problem I'm having is that I have 2 teams. "Stage3" and "Checkpoint1" Stage3 is below the blue platform, I don't want it to teleport them to Checkpoint1, Checkpoint1 should be able to teleport them to that same yellow box area.

1 answer

✓ Accepted answer

so if you want to teleport people based on their team you can do

if player in team1 then
	teleport the player to the place you want it to be at
elseif player in team 2 then
	teleport the player to a different location
end

how you get the team is game.players.localplayer.Team so it would be

if game.players.localplayers == blue then
	teleport player
end

do

game.Workspace.Part.Touched:Connect(function(hit)
	if game.Players.LocalPlayer.Team == game.Teams.Blue then
		hit.Parent:moveTo(game.Workspace.Part.Position + Vector3.new(0,3,0))
	elseif game.Players.LocalPlayer.Team == game.Teams.Red then
		hit.Parent:moveTo(game.Workspace.Part.Position + Vector3.new(0,3,0))
	end
end)

THESCRIPT:

local debounce = true
script.Parent.Touched:Connect(function(hit)
	if game.Players:GetPlayerFromCharacter(hit.Parent).Team == game.Teams.Blue then
		if hit.Parent:FindFirstChild("Humanoid") then
			if debounce then
				hit.Parent:moveTo(game.Workspace.Partabc.Position + Vector3.new(0,3,0))
			wait(0.5)
			debounce = true
			end
		end
	end
end)

you can copy this script directly into a regular script into the blue part

16 comments

0

hope this helped!

0

sorry i dont know anything about scripting, i'm just a builder trying to make this happen. i don't know what to add on to the first script and do i make 2 scripts for both of those?

0

replace game.workspace.part with where it is and same with game.teams.blue

0

doesn't seem to be working for me, i put that script into the part where i want it to teleport and nothing seems to do anything. i just go through it without getting teleported

0

so to make it be paste -able you need to tell me the names of the parts (the names should be unique) and give me the names of the team and the script should be a local script inside of starter pack not the brick

0

the team names are "Stage3" (which is below the blue teleport if you look at the screenshot) and "Checkpoint1" (where the yellow box area is in the screenshot) note: i don't want Stage3 to teleport at all they should be able to pass through the blue platform, only Checkpoint1 should be able to teleport. The blue teleport platform is just called "Trigger1"

0

wait the team names are stage3 and checkpoint1? is stage3 a team or a part?

0

Stage3 is a team

0

is it the only team there?

0

https://puu.sh/FTOwT.png seen here, yellow box area is Checkpoint1 team, red box area is Stage3 team, blue platform is Trigger1 part.

0

wait that is what u want it to do? if it is ok that if when ever you stand on the blue part you die you can make it so they are spawnpoints and the blue part has a killscript i'll edit my answer to show u the kill script

0

to make it a spawnpoint add spawnpont to workspace and replace the block completely with it do the same for the other part then go to properties go all the way down to teams then change the team color to the teams color unselect neutral

0

then if you want it to change the teams color if you step on it to that color then select allowteamchangeontouch

0

no, i don't want the player to be killed. all i need is if the player is in stage3, nothing happens to them they continue on. but once they Checkpoint1, then the blue platform will be able to teleport them back to the chekpoint if they fall down.

0

ok making the script right now...

0

if i remove all of my comments it will make u look crazy >:)

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