Here is my script which is not working right now.
And is it possible to make that team only? Like if the player is on the earth green team it does not spawn but when he is on the light blue team it will. Sorry, I'm not the best when it comes to scripting.
game.Players.PlayerAdded:Connect(function(plr) if plr:GetRankInGroup(5090028) == 2 then local tool = game.ServerStorage["X-26"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 3 then local tool = game.ServerStorage["X-26"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 4 then local tool = game.ServerStorage["X-26"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 5 then local tool = game.ServerStorage["X-26"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 6 then local tool = game.ServerStorage["X-26"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 7 then local tool = game.ServerStorage["X-26"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 8 then local tool = game.ServerStorage["X-26"]:Clone() tool.Parent = plr:WaitForChild("Backpack") --Flashlight elseif plr:GetRankInGroup(5090028) == 1 then local tool = game.ServerStorage["Flashlight"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 2 then local tool = game.ServerStorage["Flashlight"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 3 then local tool = game.ServerStorage["Flashlight"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 4 then local tool = game.ServerStorage["Flashlight"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 5 then local tool = game.ServerStorage["Flashlight"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 6 then local tool = game.ServerStorage["X-26"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 7 then local tool = game.ServerStorage["Flashlight"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 8 then local tool = game.ServerStorage["Flashlight"]:Clone() tool.Parent = plr:WaitForChild("Backpack") --Police Baton elseif plr:GetRankInGroup(5090028) == 2 then local tool = game.ServerStorage["PoliceBaton"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 3 then local tool = game.ServerStorage["PoliceBaton"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 4 then local tool = game.ServerStorage["PoliceBaton"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 5 then local tool = game.ServerStorage["PoliceBaton"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 6 then local tool = game.ServerStorage["PoliceBaton"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 7 then local tool = game.ServerStorage["PoliceBaton"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 8 then local tool = game.ServerStorage["PoliceBaton"]:Clone() tool.Parent = plr:WaitForChild("Backpack") --Pepper Spray elseif plr:GetRankInGroup(5090028) == 2 then local tool = game.ServerStorage["PepperSpray"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 3 then local tool = game.ServerStorage["PepperSpray"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 4 then local tool = game.ServerStorage["PepperSpray"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 5 then local tool = game.ServerStorage["PepperSpray"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 6 then local tool = game.ServerStorage["PepperSpray"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 7 then local tool = game.ServerStorage["PepperSpray"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 8 then local tool = game.ServerStorage["Glcok 18"]:Clone() tool.Parent = plr:WaitForChild("Backpack") --Glock elseif plr:GetRankInGroup(5090028) == 3 then local tool = game.ServerStorage["Glock 18"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 4 then local tool = game.ServerStorage["Glock 18"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 5 then local tool = game.ServerStorage["Glock 18"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 6 then local tool = game.ServerStorage["Glock 18"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 7 then local tool = game.ServerStorage["Glock 18"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 8 then local tool = game.ServerStorage["Glock 18"]:Clone() tool.Parent = plr:WaitForChild("Backpack") --ACR elseif plr:GetRankInGroup(5090028) == 3 then local tool = game.ServerStorage["ACR"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 4 then local tool = game.ServerStorage["ACR"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 5 then local tool = game.ServerStorage["ACR"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 6 then local tool = game.ServerStorage["ACR"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 7 then local tool = game.ServerStorage["ACR"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 8 then local tool = game.ServerStorage["ACR"]:Clone() tool.Parent = plr:WaitForChild("Backpack") end end)
If you're looking for multiple items, you will not get them because once it finds an "if" that is correct, it will run the script and go past all the other elseif's. Here's what I mean as I'm not good explaining errors.
game.Players.PlayerAdded:Connect(function(plr) if plr:GetRankInGroup(5090028) == 2 then local tool = game.ServerStorage["X-26"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 3 then local tool = game.ServerStorage["X-26"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 4 then local tool = game.ServerStorage["X-26"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 5 then local tool = game.ServerStorage["X-26"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 6 then local tool = game.ServerStorage["X-26"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 7 then local tool = game.ServerStorage["X-26"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 8 then local tool = game.ServerStorage["X-26"]:Clone() tool.Parent = plr:WaitForChild("Backpack") end --Flashlight if plr:GetRankInGroup(5090028) == 1 then local tool = game.ServerStorage["Flashlight"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 2 then local tool = game.ServerStorage["Flashlight"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 3 then local tool = game.ServerStorage["Flashlight"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 4 then local tool = game.ServerStorage["Flashlight"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 5 then local tool = game.ServerStorage["Flashlight"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 6 then local tool = game.ServerStorage["X-26"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 7 then local tool = game.ServerStorage["Flashlight"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 8 then local tool = game.ServerStorage["Flashlight"]:Clone() tool.Parent = plr:WaitForChild("Backpack") end --Police Baton if plr:GetRankInGroup(5090028) == 2 then local tool = game.ServerStorage["PoliceBaton"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 3 then local tool = game.ServerStorage["PoliceBaton"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 4 then local tool = game.ServerStorage["PoliceBaton"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 5 then local tool = game.ServerStorage["PoliceBaton"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 6 then local tool = game.ServerStorage["PoliceBaton"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 7 then local tool = game.ServerStorage["PoliceBaton"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 8 then local tool = game.ServerStorage["PoliceBaton"]:Clone() tool.Parent = plr:WaitForChild("Backpack") end --Pepper Spray if plr:GetRankInGroup(5090028) == 2 then local tool = game.ServerStorage["PepperSpray"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 3 then local tool = game.ServerStorage["PepperSpray"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 4 then local tool = game.ServerStorage["PepperSpray"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 5 then local tool = game.ServerStorage["PepperSpray"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 6 then local tool = game.ServerStorage["PepperSpray"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 7 then local tool = game.ServerStorage["PepperSpray"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 8 then local tool = game.ServerStorage["Glcok 18"]:Clone() tool.Parent = plr:WaitForChild("Backpack") end --Glock if plr:GetRankInGroup(5090028) == 3 then local tool = game.ServerStorage["Glock 18"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 4 then local tool = game.ServerStorage["Glock 18"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 5 then local tool = game.ServerStorage["Glock 18"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 6 then local tool = game.ServerStorage["Glock 18"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 7 then local tool = game.ServerStorage["Glock 18"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 8 then local tool = game.ServerStorage["Glock 18"]:Clone() tool.Parent = plr:WaitForChild("Backpack") end --ACR if plr:GetRankInGroup(5090028) == 3 then local tool = game.ServerStorage["ACR"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 4 then local tool = game.ServerStorage["ACR"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 5 then local tool = game.ServerStorage["ACR"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 6 then local tool = game.ServerStorage["ACR"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 7 then local tool = game.ServerStorage["ACR"]:Clone() tool.Parent = plr:WaitForChild("Backpack") elseif plr:GetRankInGroup(5090028) == 8 then local tool = game.ServerStorage["ACR"]:Clone() tool.Parent = plr:WaitForChild("Backpack") end end)
Please comment on this question if I got anything wrong.