Hello, I’m trying to make a script so when my staff join my game they automatically have a staff shirt of there avatar. Idk where to put the script, how to script it, nor what type of script to use. If you can help please do, thanks!
Do you want them to have classic shirts (2D ones) or layered clothing (3D accessories)?
Classic ones, I already have the shirts made
Can’t you just change the Shirt ID …
You could, and I think you’re forced to wear one.
Yes, but that makes all users have it instead of just staff
The staff members are in a roblox group?
Yes, all staff are in a group just for them
Okay, here’s a script:
local staffID = 3130632647 --Replace this with their user ID. I put mine.
local staffShirtID = 607785311 --Replace this with the desired shirt ID.
game.Players.PlayerAdded:Connect(function(player)
wait(4) --The character needs to load in.
if player.UserId == staffID then --Checks if the player's user ID matches.
if player.Character:FindFirstChild("Shirt") then --If there is a shirt...
player.Character:FindFirstChild("Shirt").ShirtTemplate = "http://www.roblox.com/asset/?id="..staffShirtID --Replace the shirt.
end
end
end)
Put it in a normal script (is it called server script?) in ServerScriptService. Keep in mind that I made this with the idea of only 1 staff member. If you want everyone in a group, that’s outside of my coding capabilities. Also, if the staff member doesn’t have a classic shirt selected, it won’t change anything. Finally, if they are wearing layered clothing it will most likely completely cover the shirt. Hope it helps and let me know if anything goes wrong (I sound like ChatGPT rn)!
Firstly, please do not have set wait times on a PlayerAdded event. Use Player.CharacterAdded:Wait()
instead.
Secondly, you would get a player’s role in a group using Player:GetRoleInGroup(GroupId)
.
-- reg script in ServerScriptService
local allowed = {"2112Jay", "SomeOtherGuy"}
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(Character)
Character:WaitForChild("Shirt")
for _, v in ipairs(allowed) do
if player.Name == v then
player.Character.Shirt.ShirtTemplate = "rbxassetid://5586414654"
break
end
end
end)
end)
You could make more for next loops here and have more lists also.
local allowed = {“SomeOtherGuy”, “ThatGuysFriend”}
local admins = {“2112Jay”, “MyGoodFriend”}
Once I start seeing V’s, I pass out.
Even with that you still have to wait for the shirt to be there … Character:WaitForChild(“Shirt”)
Here is when implemented on group
local staffShirtID = 607785311 --Replace this with the desired shirt ID.
local PlayerService = game:GetService("Players") -- Get service
PlayerService.PlayerAdded:Connect(function(plr)
if plr:GetRankInGroup(00000000) --[[ Set ur group id here ]] > 254 --[[ Set the staff rank number here ]] then
local shirt = plr.Character:WaitForChid("Shirt")
shirt.ShirtTemplate = "rbxassetid://" .. staffShirtID --Replace the shirt.
end
end)
I used a bit of Freezing_Insolent code here, it should work
Yeah, I’m not a great scripter. I’m trash with even mildly complex stuff like this.
That means the variable don’t need to be anything special, it’s just a temp used for the moment.
Hey, thanks for helping! It did not work, but at least you tried and that’s all that matters, don’t let them get mad at you just because you made a mistake, we all make mistakes and we learn from them!
This does not work, I tired it multiple times
Did you change the ShirtID’s and stuff?
Yeah, unless I’m doing something wrong
local staffShirtID = 13523043925 --Replace this with the desired shirt ID.
local PlayerService = game:GetService("Players") -- Get service
PlayerService.PlayerAdded:Connect(function(plr)
if plr:GetRankInGroup(17256639) --[[ Set ur group id here ]] > 1 --[[ Set the staff rank number here ]] then
local shirt = plr.Character:WaitForChid("Shirt")
shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=13523043917" .. staffShirtID --Replace the shirt.
end
end)