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

How do I create spawns and teams for Roblox Groups?

I am made a Roblox Military Group (The Libertarians | Protecting Liberty and Justice). And in my game I want it to be where if you are in the group, you automatically join the green team, and spawn in base. I have tried different codes, but nothing has worked! This is the most recent one, and I put it inside of the team I wanted to have them spawn into.

function Enter(newPlayer) if newPlayer:IsInGroup(3316542) then newPlayer.Camo=script.Parent.Camo end end

game.Players.ChildAdded:connect(Enter)

1 comment

0

Format your code using Lua Code block

1 answer

Hi, so this script I am about to explain needs to be inside a spawnlocation(The spawnlocation must be in workspace). Go to the spawn locations property menu, the spawnlocations TeamColor MUST be the same as the Teams Team Color..and After this you simply needs to put the spawn where ever you want it to be..

function Enter(newPlayer) -- This is the function that starts the script
if newPlayer:IsInGroup(123232) then -- Put the group id where the numbers are
	newPlayer.TeamColor=script.Parent.TeamColor 
	end 
end


game.Players.ChildAdded:connect(Enter) -- This is using the Childadded connection for whenever the player enters the game.. this is connection is what allows the function "Enter" to activate!


This should work, let me know if it doesnt.. Oh and make sure under all of your "teams Properties" that none of them are checked "AutoAssignable". Feel Free to accept my answer if it helped:)

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