Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 10 years ago

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?

0
Is the Group-Team "AutoAssignable"? BlueTaslem 18071 — 10y
0
No, the raiders is. BosswalrusTheCoder 88 — 10y
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). Tkdriverx 514 — 10y

2 answers

Log in to vote
0
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
10 years ago

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

Ad
Log in to vote
0
Answered by 10 years ago

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! :)

Answer this question