I’m trying to make team spawns but they dont work. I did everything right but it doesnt spawn on the selected teams spawnLocation. It spawns the player on neutral spawnLocation.
3 Likes
Is the team color the same as the team color? Is AutoAssingable turned off? And if you have neutral off you have to make sure that every team has a spawn.
2 Likes
Oh i didnt know every team need to have a SpawnLocation. Autoassignable is off and team color is same as the team color.
2 Likes
-- Get the Teams service
local Teams = game:GetService("Teams")
-- Create a new team
local team1 = Instance.new("Team")
team1.Name = "Team1"
team1.TeamColor = BrickColor.new("Bright red")
-- Parent the team to the Teams service
team1.Parent = Teams
-- Create a function to spawn a player at a team spawn location
local function spawnPlayer(player)
local spawnLocation = workspace.Team1Spawn -- Adjust the spawn location based on your setup
if spawnLocation then
-- Clone the player's character model
local characterClone = player.Character:Clone()
-- Remove the existing character model
player.Character:Destroy()
-- Set the new character model's parent to the spawn location
characterClone.Parent = spawnLocation
-- Load the character model back into the player
player.Character = characterClone
end
end
-- Connect the spawn function to the PlayerAdded event for each player
game.Players.PlayerAdded:Connect(function(player)
-- Assign the player to the Team1
player.Team = team1
-- Call the spawn function for the new player
spawnPlayer(player)
end)
2 Likes
Add to your script and team Service
1 Like
Thank you it worked !
1 Like
No problem welcome you thank you
1 Like