I made a script that would make players spawn in a box. In this box people would see a GUI that would have 4 choices on where to spawn. With the code below it works. The problem is I want the code to teleport the players on a certain team to the box spawn, and then give those players on that team the gui. The following hasn't worked.

local spawns = game.Workspace.Spawns
local SpawnNumber = math.random(1, 4)
local Spawnplate = spawns:FindFirstChild('Spawn' .. SpawnNumber)
local frame = script.Frame:Clone()

game.Players.PlayerAdded:connect(function(player)
	player.Changed:connect(function(character)
		
		-- if player.TeamColor = "Sea green" then
		
		repeat wait() until player.Character
		player.Character:MoveTo(Spawnplate.Position)
		
		repeat wait() until player.PlayerGui.PlayerGuis
		frame.Parent = player.PlayerGui.PlayerGuis
		
		--end
		
		
		end)
end)

7 comments

0

try using :PrimaryPartCFrame(Spawnplate.Position) than using :MoveTo

0

That didn't work

0

Bro, ur script works for me.

0

What exactly is the issue? Are you using ServerScript?

0

Yes. Should it be a local script within the character?

0

I just tried the script in local form and modified it a litte, nothing worked.

0

NVM it's working now thanks.