iceprofit
|
  |
| Joined: 11 Apr 2013 |
| Total Posts: 417 |
|
|
| 04 Dec 2013 07:57 PM |
What do I need to add? I spawn at the right spawn on entry, but after resetting it spawns me somewhere random.
WOJid = 187343 alliesgroupids = {137436} --Add the ids of WOJ allies.
WOJteamname = "WOJ Members" alliesgroupteamname = "WOJ Allies" enemyteamname = "Raiders"
--Don't change below this line. function checkallies(person) for i = 1,#alliesgroupids do if person:IsInGroup(alliesgroupids[i]) then return true end end return false end
function changeteam(player) if player:IsInGroup(187343) then player.TeamColor = game.Teams[WOJteamname].TeamColor player.Character:MoveTo(game.Workspace.WOJ.Position) elseif checkallies(player) == true then player.TeamColor = game.Teams[alliesgroupteamname].TeamColor player.Character:MoveTo(game.Workspace.Allies.Position) else player.TeamColor = game.Teams[Raiders].TeamColor player.Character:MoveTo(game.Workspace.Raiders.Position) end end
game.Players.ChildAdded:connect(changeteam)
|
|
|
| Report Abuse |
|
|
iceprofit
|
  |
| Joined: 11 Apr 2013 |
| Total Posts: 417 |
|
| |
|
|
| 04 Dec 2013 07:59 PM |
You need to run this every time the player re-spawns. Right now, you check when a player is added and them move them to the correct spawn, but you aren't checking for when they re-spawn.
Use .CharacterAdded() to check each time the player's character re-spawns.
http://wiki.roblox.com/index.php/CharacterAdded_%28Event%29 |
|
|
| Report Abuse |
|
|
|
| 04 Dec 2013 07:59 PM |
function checkallies(person) for i = 1,#alliesgroupids do if person:IsInGroup(alliesgroupids[i]) then return true end end return false end
Eww
function checkallies(person) for i,v in pairs(alliesgroupids) do if person:IsInGroup(v) then return true end end return false end |
|
|
| Report Abuse |
|
|
|
| 04 Dec 2013 08:07 PM |
Just rewrote it for you
groupid = 187343 allies = {137436}
grouptn = "WOJ Members" allytn = "Allies" enemeytn = "Raiders"
function checkallies(person) for i,v in pairs(allies) do if person:IsInGroup(v) then return true end end return false end
game.Players.PlayerAdded:connect(function changeteam(player) if player:IsInGroup(groupid) then print("Player is in the group") player.TeamColor = game.Teams[grouptn].TeamColor player.Character.Torso.CFrame = CFrame.new(game.Workspace.WOJ.Position) elseif checkallies(player) then print("Player is an ally") player.TeamColor = game.Teams[allytn].TeamColor player.Character.Torso.CFrame = CFrame.new(game.Workspace.Allies.Position) else print("Player is a raider") player.TeamColor = game.Teams[enemeytn].TeamColor player.Character.Torso.CFrame = CFrame.new(game.Workspace.Raiders.Position) end end) |
|
|
| Report Abuse |
|
|
|
| 04 Dec 2013 08:08 PM |
| Just set the spawn's team to the specific teamcolor, and uncheck neutral. |
|
|
| Report Abuse |
|
|