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
try using :PrimaryPartCFrame(Spawnplate.Position) than using :MoveTo
That didn't work
Bro, ur script works for me.
What exactly is the issue? Are you using ServerScript?
Yes. Should it be a local script within the character?
I just tried the script in local form and modified it a litte, nothing worked.
NVM it's working now thanks.