Group Rank Uniform For Teams

I’m trying to make a script for a game I’m making where if youre on one specific team and your group rank is a specific one you get a specific clothing item.

The issue is, whenever I test it, it just wont put the clothing items on the character no matter what I do.
I’ve checked all over the dev forum to see if I could get a solution but I could not find any.

Here’s the code, if someone knows what is wrong with this please let me know.

local players = game:GetService("Players") -- Gets the player service
local storage = game:GetService("ReplicatedStorage") -- Gets replicatedstorage
local servers = game:GetService("ServerScriptService")
local execshirt = storage.Team:WaitForChild("execshirt") -- Gets the execshirt from replicatedstorage
local execpants = storage.Team:WaitForChild("execpants") -- gets the execpants from replicatedstorage
local hcshirt = storage.Team:WaitForChild("hcshirt") -- Gets the hcshirt from replicatedstorage
local hcpants = storage.Team:WaitForChild("hcpants") -- Gets the hcpants from replicatedstorage
local hsShirt = storage.Team:WaitForChild("hsShirt") -- Gets the hsShirt from replicatedstorage
local hsPants = storage.Team:WaitForChild("hsPants") -- Gets the hspants from replicatedstorage
local ocShirt = storage.Team:WaitForChild("ocShirt") -- Gets the ocshirt from replicatedstorage
local ocPants = storage.Team:WaitForChild("ocPants") -- Gets the ocpants from replicatedstorage
local shirt = storage.Team:WaitForChild("Shirt") -- Gets the shirt from replicated storage
local pants = storage.Team:WaitForChild("Pants")
local Debounce = false
local GroupID = 13332832-- Group Id
players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		player.CharacterAppearanceLoaded:Connect(function(character)
			local PlayerRank = player:GetRankInGroup(GroupID)
			if player.Team.Name == "Hospital Staff" then
				if character:FindFirstChild("Pants") then
					character:FindFirstChild("Pants"):Destroy()
					if PlayerRank >= 3 then
						local ocShirtClone = ocShirt:Clone()
						ocShirtClone.Parent = character
					elseif PlayerRank >= 8 then
						local hsShirtClone = hsShirt:Clone()
						hsShirtClone.Parent = character
					end
				else
					if player.Team.Name == "Hospital Staff" then
						if character:FindFirstChild("Pants") then
							character:FindFirstChild("Pants"):Destroy()
							if PlayerRank >= 3 then
								local ocShirtClone = ocShirt:Clone()
								ocShirtClone.Parent = character
							elseif PlayerRank >= 8 then
								local hsShirtClone = hsShirt:Clone()
								hsShirtClone.Parent = character
							end
						end
					end
				end
			end
		end)
	end)
end)

Note: There is no error in the output)

Did you try adding any print statements or breakpoints? Those could help troubleshoot.

I did, I didn’t print anything sadly.

1 Like

Side note, the Debounce variable in your script is not used. It is only defined.

I will remove that, Im not sure if that will help with it though…

Has anyone found a solution?
I can’t seem to get anything to work