Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Can you help me please?i have a problem with spawnpoints

I have two teams police and prisoners. i puted around the prison spawnpoints and set them to change team when touch. but i want this to work only with prisoners because when i exit the prison as a police officer it changes my team to criminals.How do i make this work only with prisoners team???

1 comment

0

if team ~= prisoner then end

1 answer

Firstly turn off the change team thing in the spawn points, we will do it using scripts. Create a "Folder" in the Workspace called "CriminalSpawns" and put all the criminal spawns in that folder. Now create a script in ServerScriptService and put in the following.

for i,v in pairs(workspace.CriminalSpawns:GetChildren()) do
	v.Touched:Connect(function(hit)
		if hit.Name == "HumanoidRootPart" then
			local player = game.Players:FindFirstChild(hit.Parent.Name)
			if player.Team = game.Teams:FindFirstChild("Prisoners") then
				player.Team = game.Teams:FindFirstChild("Criminals")
				player.Neutral = false
			end
		end
	end)
end

If that doesn't work DM me on discord MachoPiggies#3484!

This discussion is preserved as it was. New answers, comments, and votes are closed.