janlari
|
  |
| Joined: 09 Dec 2008 |
| Total Posts: 311 |
|
|
| 22 Sep 2014 08:14 AM |
Hello, i found a script that gives a tool when the player joined a team. (How it works? You have to put the tool inside the team) Example: Bright yellow (m4a) then Bright blue (mp5) but the problem is.. you have to respawn in order to get the tools. I'm wondering if you guys can do it like example you switch to Bright yellow then gets m4a then switch Bright blue you lose the m4a then you get mp5 without respawning, you get them instantly. Is that possible? here is the script
function resp(add) Teams = game.Teams:GetChildren() p = game.Players:GetChildren() for i=1,#p do if add.Name == p[i].Name then for I=1,#Teams do if p[i].TeamColor == Teams[I].TeamColor then
W = Teams[I]:GetChildren() for x=1,#W do W[x]:Clone().Parent = game.Players[add.Name].Backpack end
end end end end end
game.Workspace.ChildAdded:connect(resp) |
|
|
| Report Abuse |
|
OzzyFin
|
  |
| Joined: 07 Jun 2011 |
| Total Posts: 3600 |
|
|
| 22 Sep 2014 08:55 AM |
in localscript in starterpack or gui
plr = game.Players.LocalPlayer char = plr.Character teams = game:GetService("Teams")
function cleartools(bool) for _,tool in pairs(plr.Backpack:GetChildren()) do local isb = tool:FindFirstChild("isblue") if isb and isb.Value == not bool then tool:Destroy() end end for _,tool in pairs(plr.StarterGear:GetChildren()) do local isb = tool:FindFirstChild("isblue") if isb and isb.Value == not bool then tool:Destroy() end end for _,tool in pairs(char:GetChildren()) do local isb = tool:FindFirstChild("isblue") if isb and isb.Value == not bool then tool:Destroy() end end end
plr.Changed:connect(function(t) if t == "TeamColor" then if plr.TeamColor == BrickColor.new("Bright yellow") then for _,v in pairs(teams:GetChildren()) do if v.TeamColor == BrickColor.new("Bright yellow") then for _,tool in pairs(v:GetChildren()) do if tool:IsA("Tool") then cleartools(false) local sgtool = tool:clone() sgtool.Parent = plr.StarterGear local col = Instance.new("BoolValue",sgtool) col.Name = "isblue" col.Value = false local bptool = sgtool:clone() bptool.Parent = plr.Backpack end end end end elseif plr.TeamColor == BrickColor.new("Bright blue") then for _,v in pairs(teams:GetChildren()) do if v.TeamColor == BrickColor.new("Bright blue") then for _,tool in pairs(v:GetChildren()) do if tool:IsA("Tool") then cleartools(true) local sgtool = tool:clone() sgtool.Parent = plr.StarterGear local col = Instance.new("BoolValue",sgtool) col.Name = "isblue" col.Value = true local bptool = sgtool:clone() bptool.Parent = plr.Backpack end end end end end end end) |
|
|
| Report Abuse |
|