For example, when the player chooses team "prisoner" then they spawn in the jail, whereas if the player choose team "police" they spawn in a police station.
I have this code here trying to do what I mentioned up:
localscript:
local RemoteEvent = game.ReplicatedStorage.ChangeTeam local player = game.Players.LocalPlayer frame.prisoner.MouseButton1Click:Connect(function() RemoteEvent:FireServer(BrickColor.new(CitizenColor)) frame.Visible = not frame.Visible player.Character.HumanoidRootPart.CFrame = CFrame.new(game.Workspace.citizen.Position + Vector3.new(0, 10, 0))
Remote Event: "ChangeTeam"
SeverScriptService:
game.ReplicatedStorage.ChangeTeam.OnServerEvent:Connect(function(player,teamColor) player.TeamColor = teamColor player:LoadCharacter() end)
But the problem is that the player spawns on where I want it to spawn, then it immediately spawns on another spawn location. The Humanoid won't stay in the place where I want it to spawn :/
How do I fix this problem so that when a player chooses "prisoner" or any other team and spawns at a particular place set for that team.
Local script:
local RemoteEvent = game.ReplicatedStorage.ChangeTeam local player = game.Players.LocalPlayer frame.prisoner.MouseButton1Click:Connect(function() RemoteEvent:FireServer(player,CitizenColor) frame.Visible = not frame.Visible player.Character.HumanoidRootPart.CFrame = CFrame.new(game.Workspace.citizen.Position + Vector3.new(0, 10, 0)) end)
Global script in ServerScriptService:
game.ReplicatedStorage.ChangeTeam.OnServerEvent:Connect(function(player,CitizenColor) player.TeamColor = game.Teams.CitizenColor.TeamColor player:LoadCharacter() end)
So that should work. Just change CitizenColor to whatever your prisoner's team is called.
If that helped please up vote and accept this answer.
All the best,
PrismaticFruits