I have a TeamChange GUI at my fort, and it works mostly as intended. However, whenever the player respawns, they ONLY spawn at the Raider's spawn, which is the team everyone starts at on joining a server.
local ScreenGui = script.Parent local CoastalCombat = ScreenGui.CoastalCombat local Neutral = ScreenGui.Neutral local Raiders = ScreenGui.Raiders local player = ScreenGui.Parent.Parent local character = player.Character CoastalCombat.MouseButton1Down:connect(function() if player:IsInGroup(2546195) then player.TeamColor = BrickColor.new("Cool yellow") character.Humanoid.Health = 0 end end) Neutral.MouseButton1Down:connect(function() player.TeamColor = BrickColor.new("Bright green") character.Humanoid.Health = 0 end) Raiders.MouseButton1Down:connect(function() player.TeamColor = BrickColor.new("Bright red") character.Humanoid.Health = 0 end)
The issue lies not within your script, but in the Spawn Location
meant for certain teams. Spawn Locations have a TeamColor
property that has to be set for certain teams to be able to spawn at that specific spawn.
At the moment, your spawn probably has the neutral
property set to true. If this is so, as by the wikis denotation, "This means that any player, of any team, can spawn on it if this property is set to true."
In basic terms, anyone can spawn on a neutral spawn location.
If you do set the TeamColor property, players who are in a team associated with the same TeamColor will be able to spawn on that spawn location.
TeamColor Property: http://wiki.roblox.com/index.php?title=API:Class/SpawnLocation/TeamColor
Neutral Property: http://wiki.roblox.com/index.php?title=API:Class/SpawnLocation/Neutral
Spawn Location Object Page: http://wiki.roblox.com/index.php?title=API:Class/SpawnLocation