User not being sent to the correct spawn location

Hello everyone. (I hope this is the right topic)

So I’m having some issues with my character not being loaded into the correct spawn area.

Video linked below.

So the spawn areas are loaded by what group you are in so for example if you are in the “Sparta Group” you will spawn at “Sparta Spawn”
And if you are not in any group affiliated with the game you will spawn at “Outsider Spawn” And be put on the “Outsider team”

I’m being loaded onto the correct team but for some reason I’m not being sent to the correct spawn the majority of the time.
I have found something sort of related I think? Basically if the name tag doesn’t load properly with the user they don’t go to the correct spawn but if it does then they do. (hope that makes sense but you can see what I mean in the video)

1 Like

Show script please otherwise its hard to find whats causing the issue

There is quite a lot of scripts with this give me a moment to try and find the majority / all of them

  • Teams
local Players = game:GetService("Players")

function setTeam(player, teamName)
    player.TeamColor = game:WaitForChild("Teams")[teamName].TeamColor
	player.Neutral = false
end

function toSpawn(player)
	local s = game.Workspace.Spawns:WaitForChild(tostring(player.Team)):GetChildren()
	local rand = Random.new()
	local r = rand:NextInteger(1,#s)
	player.Character:WaitForChild("HumanoidRootPart").CFrame = CFrame.new(s[r].Position)
end

Players.PlayerAdded:Connect(function(player)
	setTeam(player, "Menu")
	
	player.CharacterAdded:Connect(function(chr)
		if player:IsInGroup(6318983) then
			setTeam(player, "Sparta")
		else
		if player:IsInGroup(17180419) then -- random group for testing kinda not needed rn change later
			setTeam(player, "Rome")
		else		
			setTeam(player, "Outsiders")
			end
			end
	
		toSpawn(player)
	end)
end)


– Name tag (not sure if this is associated with the problem

game.Workspace.ChildAdded:connect(function(plr)
local name = plr.Name
local player = game.Players:FindFirstChild(plr.Name)
	if player ~= nil then
		player.CanLoadCharacterAppearance = true
		plr.Humanoid.DisplayDistanceType = "None"
		
		if player:IsInGroup(6318983) then
			local tag = game.ReplicatedStorage:WaitForChild("NameTag"):Clone()
			tag.Group.Text = "-SPARTA-"
			tag.Group.TextColor3 = Color3.fromRGB(196, 40, 28)
			local tagset = false
			
			-- BASE ROME
			if not tagset then
				local role = player:GetRoleInGroup(6318983)
				tag.Parent = plr:WaitForChild("Head")
				tag.Text.Text = name .. " | " .. role
			end
		else
			local tag = game.ReplicatedStorage:WaitForChild("NameTag"):Clone()
			tag.Group.Text = ""
			tag.Parent = plr:WaitForChild("Head")
			tag.Text.Text = name .. " | VISITOR"
		end
	end
end)

From my memory I believe these are the only 2 scripts that “mess” with the spawning and where everyone goes if I find something different I’ll be sure to update.

What about actual spawns? Are they set by team color?

I think its bc of the naming of the spawn,make sure to name the spawn by whats alined by the team and script

The actual spawns are just in the workspace like this, and no it doesn’t go off team color I believe
(altho I may be stupid but having trying that it doesn’t seem to work)

image

I’m pretty sure they’re all the same

Go to these spawns, scroll down in properties and select teamcolor as the color of the team this spawn is for

Sorry my English isn’t the best I don’t fully understand what you mean sorry. all the team colors are matching and stuff if that is what you mean

In the spawns there is a property called TeamColor. Make sure it is the same as the color of actual team

Oh right yeah they are the same sorry about me being stupid :person_facepalming:

What is this doing? Picking a random spawn?

Also maybe put toSpawn(player) right after setTeam(player)

Not 100% sure on the specifics as this was done by an old collaborator (which I have no way of talking to now sadly) but I think it picked a random spawn out of the amount of spawns that were in the folder and just picked a random one for the player to spawn at.

ok so technically if the teamcolor in spawn is the same as actual team color, this is not necessary to have - remove it and check if it works.

Doesn’t seem to fix it just seems to not send the user to the spawn point if I remove that part of the script.