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

My fort's spawns won't work, anyway to fix them?

My spawns wont work.

I have a script where if you are in my group it puts you on that team:

function onPlayerEntered(plyr)
if plyr:IsInGroup(1195141) then
plyr.TeamColor = BrickColor.new("Cyan")
end
end

game.Players.PlayerAdded:connect(onPlayerEntered)

But if you are not in the group. It makes you spawn on the Raiders's spawn but the team is still my group.. Does anyone know how to fix this?

3 comments

0

Is the Group-Team "AutoAssignable"?

0

No, the raiders is.

0

Well changing their team color doesn't automatically spawn your character on change. So maybe add a short wait before changing their team color and then teleporting the player to the correct spawn or killing the player (if you do killing, yield the code to wait for the character).

2 answers

This may be due to the "Raiders" team having the "AllowTeamChangeOnTouch" set to true that would be located under properties in a spawn.

Perhaps we could implement what Tkdriver said using the following code. However, you will need to manually set the team name in the variable 'groupteam'.

local groupteam = 'Xepitus';
local groupid = 1195141;
local group_spawn = game.Workspace['Xepitus Spawn'];
game.Players.PlayerAdded:connect(function(_)
local r = false;
local s = false;
repeat 
s,r = pcall(function() return plr.Backpack~=nil end);
until r==true;
if not(_:IsInGroup(groupid)) then return end;
_.TeamColor = game:service'Teams'[groupteam].TeamColor;
_:MoveTo(group_spawn.Position,group_spawn);
end);

Hope this helped! :)

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