So far, all of this script works perfectly apart from the fact that when I try to clone the tool at the end, it does it twice. I’ve checked and there is no other script interfering or anything that is causing two of them to enter the player’s backpack. I just want it to be one that is cloned. I’m honestly baffled with what I’ve done wrong, and I guarantee it’ll be something with an easy fix that I just haven’t noticed.
local GroupId = 10068814 --Replace 1234567 with your group ID
local RanksAndUniforms = {
{1, "http://www.roblox.com/asset/?id=1375365975", "http://www.roblox.com/asset/?id=1375387127", "ConfederateVolunteer", -- Volunteer
"ConfederateInfantryBackpack", "Pattern 1853 Enfield", "", "", ""},
{2, "http://www.roblox.com/asset/?id=1429220245", "http://www.roblox.com/asset/?id=1429225492", "1stConfederateInfantry", -- Private
"ConfederateInfantryBackpack", "Pattern 1853 Enfield", "", "", ""},
{255, "http://www.roblox.com/asset/?id=1429214494", "http://www.roblox.com/asset/?id=1429223605", "ConfederateGeneral", -- General
"ConfederateOtherBackpack", "Colt Army M1860", "Sabre", "Compass", "Spyglass",}
}
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
wait()
for i = 1, #RanksAndUniforms do
local RankAndUniform = RanksAndUniforms[i]
local RequiredRank = RankAndUniform[1]
local ShirtTemplate = RankAndUniform[2]
local PantsTemplate = RankAndUniform[3]
local Hat = RankAndUniform[4]
local Backpack = RankAndUniform[5]
local Weapon1 = RankAndUniform[6]
local Weapon2 = RankAndUniform[7]
local Tool1 = RankAndUniform[8]
local Tool2 = RankAndUniform[9]
if Player:GetRankInGroup(GroupId) == RequiredRank then
Character:WaitForChild("Shirt").ShirtTemplate = ShirtTemplate
Character:WaitForChild("Pants").PantsTemplate = PantsTemplate
local WearHat = game.ServerStorage.Hats:FindFirstChild(Hat)
local WearBackpack = game.ServerStorage.Backpacks:FindFirstChild(Backpack)
local EquipWeapon1 = game.ServerStorage:FindFirstChild(Weapon1)
local EquipWeapon2 = game.ServerStorage:FindFirstChild(Weapon2)
local EquipTool1 = game.ServerStorage:FindFirstChild(Tool1)
local EquipTool2 = game.ServerStorage:FindFirstChild(Tool2)
wait(0.4)
Character.Humanoid:AddAccessory(WearHat:Clone())
Character.Humanoid:AddAccessory(WearBackpack:Clone())
EquipWeapon1:Clone().Parent = Player.Backpack
end
end
end)
end)