Hi, I’ve been working on a cafe game for around 2 years now, recently we decided we want to improve our current version. How would I go about automatically applying uniforms onto members of staff.
I would use the PlayerAdded event and run a function that checks if they are in the group and if so then give their character model the shirt and pants.
game:GetService("Players").PlayerAdded:Connect(function(player)
local character = nil
if player:GetRankInGroup("GROUP ID") >= "RANK NUMBER" then
if player.Character then
character = player.Character
else
player.CharacterAdded:Wait()
character = player.Character
end
character:WaitForChild("Shirt").ShirtTemplate = "ASSET_LINK"
character:WaitForChild("Pants").PantsTemplate = "ASSET_LINK"
end
end)
What type of script does this have to be? Is this just a normal script, local or module?
Server Script will work for this. Press the little check mark on my OP so that others now a solution was found.
I edited your script slightly to the following
game:GetService("Players").PlayerAdded:Connect(function(player)
local character = nil
if player:GetRankInGroup("3737286") >= 5 then
if player.Character then
character = player.Character
else
player.CharacterAdded:Wait()
character = player.Character
end
character:WaitForChild("Shirt").ShirtTemplate = "https://www.roblox.com/catalog/2975693828/Uniform-Shirt-V2"
character:WaitForChild("Pants").PantsTemplate = "https://www.roblox.com/catalog/2975698905/Uniform-Pants"
end
end)
However, when I load it into studio/normal game I get the following errors:
Have you tried using the 2d image file? I’m not quite sure what asset link roblox requires for the shirts and pants.
Pretty much the same solution, just use shirt / pants objects instead.
Turns out it uses the following asset link
rbxassetid://
This code does only work for me and not for my friends when they test it is that possible to fix?