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

How to make a working Group Only Spawn?

I am trying to make a Group Only Spawn, but it just isn't working out for me. I am inserting the script into the spawn pad, but I can still change to that team even without being in the group through the team change gui that I have set up. Can somebody tell me what I am doing wrong?

group = 2960649
deb = true
function Check(p)
if p ~= nil then 
deb = false 
local human = p.Parent
if human ~= nil then
local player = game.Players:GetPlayerFromCharacter(human)
if player ~= nil then
if player:IsInGroup(group) then
player.TeamColor = BrickColor.new("Really Red")
end
end
end
end
end
script.Parent.Touched:connect(Check)

2 answers

To make it easier put this in a script in a part you want them to spawn on:

local groupid = nil -- Group id here
local spawnpart = script.Parent

game.Players.PlayerAdded:connect(function(player)
	if player:IsInGroup(groupid) then
		local char = player.Character
		char:MoveTo(spawnpart.Position)
	end
	player.Character.Humanoid.Died:connect(function)
		wait(5) -- this is needed to make sure the player has respawned (change if needed)
		if player:IsInGroup(groupid) then
		local char = player.Character
		char:MoveTo(spawnpart.Position)
	end
	end)
end)

Hope this helps!

What it does:

When the player joins the game it checks to see if the player is in the group, then if they are it will tp them to the part the script is in. Once that player dies it will check again if they are in the group if so it will spawn them at the part again.

1 comment

0

Explain how this works to the asker?

group = 2960649
deb = true


script.Parent.Touched:connect(function(p)
if p ~= nil then 
deb = false 
local human = p.Parent
if human ~= nil then
local player = game.Players:GetPlayerFromCharacter(human)
if player ~= nil then
if player:IsInGroup(group) then
player.TeamColor = BrickColor.new("Really Red")
end
end
end
end
end)

I dont get your question. Is the touch script not working or the gui oone not working or both? If this one isn't working, tests if my version works. I cant help you with the gui one scince you haven't given it. Any errors in output?

2 comments

0

No errors in output, also you script seems to work when they aren't in the group, but whenever someone clicks to change to the team with your script in it, they always get switched to a Neutral team.

0

Hmm, I'm not sure then... did you set up a team already in the team folder in explorer with the color "Really Red"? If so, try difrent colors. Also, for those spawns, un-check neutral in the properties

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