Hi, I have a script that gives different tools when on different teams. For example, red team gets this weapon and blue team gets a different weapon.But the script won’t work, can someone please help me out? Any help is appreciated, thanks!
local players = game:GetService("Players")
players.PlayerAdded.Connect(function(p)
p.CharacterAdded:Connect(function(Char)
local Folder = script:FindFirstChild(p.TeamName)
if Folder then
--If team has spawn tools
local Tools = Folder:FindFirstChild("Tools")
if Tools then
--Goes through the tools
for i,v in pairs(Tools:GetChildren())do
--Puts in user inventory when made copy
v:Clone().Parent = p.Backpack
end
end
end
end)
end)
Hi, I’ve followed what you said but the script still wouldn’t function.
local players = game:GetService("Players")
players.PlayerAdded.Connect(function(p)
p.CharacterAdded:Connect(function(Char)
local Folder = script:FindFirstChild(p.Team.Name)
if Folder then
--If team has spawn tools
local Tools = Folder:FindFirstChild("Tools")
if Tools then
--Goes through the tools
for i,v in pairs(Tools:GetChildren())do
--Puts in user inventory when made copy
v:Clone().Parent = p.Backpack
end
end
end
end)
end)
local players = game:GetService("Players")
players.PlayerAdded.Connect(function(p)
p.CharacterAdded:Connect(function(Char)
local Folder = script:FindFirstChild(p.Team.Name)
print(Folder)
if Folder then
--If team has spawn tools
local Tools = Folder:FindFirstChild("Tools")
print(Tools)
if Tools then
--Goes through the tools
for i,v in pairs(Tools:GetChildren())do
--Puts in user inventory when made copy
v:Clone().Parent = p.Backpack
end
end
end
end)
end)