generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Team tool fix

Previous Thread :: Next Thread 
janlari is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image