Staff only shirt

Try this one, I have improved on from @i_iiAngel’s script he sent.

-- Replace with the desired shirt ID and your group ID
local staffShirtID = 607785311
local groupID = 12345678 -- Your group ID goes here
local staffRankNumber = 254 -- Staff rank number goes here

local PlayerService = game:GetService("Players")

PlayerService.PlayerAdded:Connect(function(plr)
	-- Check player's rank in the group
	if plr:IsInGroup(groupID) and plr:GetRankInGroup(groupID) > staffRankNumber then
		plr.CharacterAdded:Connect(function(character)
			local shirt = character:FindFirstChild("Shirt")
			-- Check if the shirt is there
			if shirt then
				shirt.ShirtTemplate = "rbxassetid://" .. staffShirtID -- Replace the shirt
			else
				-- If shirt doesn't exist, create a new one
				local newShirt = Instance.new("Shirt")
				newShirt.ShirtTemplate = "rbxassetid://" .. staffShirtID
				newShirt.Parent = character
			end
		end)
	end
end)

I should mention when you set the staff rank number to like 54 for example, anything 54 or higher will receive the staff shirt.

1 Like

Yeah, I was just correcting that specific line since I was distracted by the wait(4). CharacterAppearanceLoaded also works in this case.

I tried it and it does not work, it just keeps my original shirt on

-- Replace with the desired shirt ID and your group ID
local staffShirtID = 13523043925 
local groupID = 17256639 -- Your group ID goes here
local staffRankNumber = 1 -- Staff rank number goes here

local PlayerService = game:GetService("Players")

PlayerService.PlayerAdded:Connect(function(plr)
	-- Check player's rank in the group
	if plr:IsInGroup(groupID) and plr:GetRankInGroup(groupID) > staffRankNumber then
		plr.CharacterAdded:Connect(function(character)
			local shirt = character:FindFirstChild("Shirt")
			-- Check if the shirt is there
			if shirt then
				shirt.ShirtTemplate = "rbxassetid://13523043925" .. staffShirtID -- Replace the shirt
			else
				-- If shirt doesn't exist, create a new one
				local newShirt = Instance.new("Shirt")
				newShirt.ShirtTemplate = "rbxassetid://13523046235" .. staffShirtID
				newShirt.Parent = character
			end
		end)
	end
end)

I’ve noticed this:

if plr:GetRankInGroup(17256639) --[[ Set ur group id here ]] > 1 --[[ Set the staff rank number here ]] then

The staff rank number should be the rank number you chose when you made the role. I’m pretty sure if it’s set to 1, everyone has the shirt. This quickly turns into a problem if the group is supposed to have the game’s fans in it (like LSplash or Minitoon’s group).

I set it to one because only staff are in that group

1 Like
if plr:IsInGroup(groupID) and plr:GetRankInGroup(groupID) > staffRankNumber then

This line checks if the User is ONLY greater than the staffRankNumber that was assigned earlier. So, if everyone is ranked 1 on the group, no one will have the ability to get the shirt. Try replacing the greater sign (>) with (>=). Example:

if plr:IsInGroup(groupID) and plr:GetRankInGroup(groupID) >= staffRankNumber then

Either that or it might not work in Studio.

Hold on, I’ll try to join your group.

It does not work, just puts a red underline under it

A red underline where? (has to be 30 letters long)

There are like red lines under it and others

-- Replace with the desired shirt ID and your group ID
local staffShirtID = 13523043925 
local groupID = 17256639 -- Your group ID goes here
local staffRankNumber = 1 -- Staff rank number goes here --DON'T CHANGE IT HERE

local PlayerService = game:GetService("Players")

PlayerService.PlayerAdded:Connect(function(plr)
	-- Check player's rank in the group
	if plr:IsInGroup(groupID) and plr:GetRankInGroup(groupID) >= staffRankNumber then
		plr.CharacterAdded:Connect(function(character)
			local shirt = character:FindFirstChild("Shirt")
			-- Check if the shirt is there
			if shirt then
				shirt.ShirtTemplate = "rbxassetid://13523043925" .. staffShirtID -- Replace the shirt
			else
				-- If shirt doesn't exist, create a new one
				local newShirt = Instance.new("Shirt")
				newShirt.ShirtTemplate = "rbxassetid://13523046235" .. staffShirtID
				newShirt.Parent = character
			end
		end)
	end
end)

It’s supposed to be like this. Red underlines mean that there is an error. I love helping people at 1 AM
Screenshot 2023-05-23 010939

Sorry!

Okay, I will try the code, give me a few minutes, doing something else

1 Like

No problem! I usually drift off to slumber at like 4 AM so it’s fine by me.

1 Like

Nope, still does not work. I even tried it in the actual game

Sorry, I can’t do anything. I’ve done all I can.

Try replacing this with .CharacterAppearanceLoaded. I was having trouble with editing shirts a while ago, and this was the issue.

This makes sure that the shirts and pants have also loaded.

Documentation:

Still does not work, here is the code:

-- Replace with the desired shirt ID and your group ID
local staffShirtID = 13523043925 
local groupID = 17256639 -- Your group ID goes here
local staffRankNumber = 1 -- Staff rank number goes here --DON'T CHANGE IT HERE

local PlayerService = game:GetService("Players")

PlayerService.PlayerAdded:Connect(function(plr)
	-- Check player's rank in the group
	if plr:IsInGroup(groupID) and plr:GetRankInGroup(groupID) >= staffRankNumber then
		plr.CharacterAppearanceLoaded:Connect(function(character)
			local shirt = character:FindFirstChild("Shirt")
			-- Check if the shirt is there
			if shirt then
				shirt.ShirtTemplate = "rbxassetid://13523043925" .. staffShirtID -- Replace the shirt
			else
				-- If shirt doesn't exist, create a new one
				local newShirt = Instance.new("Shirt")
				newShirt.ShirtTemplate = "rbxassetid://13523046235" .. staffShirtID
				newShirt.Parent = character
			end
		end)
	end
end)

It seems like you are appending the shirt ID with an existing ID? Is this intentional or were you trying to do

shirt.ShirtTemplate = `rbxassetid://{staffShirtID}`
-- ...
newShirt.ShirtTemplate  = `rbxassetid://{staffShirtID}`

Also it seems you should remove CharacterAppearanceLoaded, as from my testing, it doesn’t seem to be firing in this case.

That was in the script someone else put in the topic

Instead of using wait(4), you need to use if not player.Character then player.CharacterAdded:Wait() end. There is no guarantee that the player’s character will be loaded in four seconds or less. It could take a longer amount of time for the player’s character to load.