Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to make players in a Team wear their own clothing?

Hi, I am currently working on a cafe game and I want that only the Barista-Team has a job outfit. How do I make the Costumer-Team have their own clothing? This is what my script looks like now:

local ss = game:GetService("ServerStorage")

game.Players.PlayerAdded:Connect (function (player)
	player.CharacterAdded:Connect (function (character)
		if player.Team == game.Teams.Barista then 

		local shirt = character:WaitForChild("Shirt")
		local pants = character:WaitForChild("Pants")

			shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=000000"
			pants.PantsTemplate = "http://www.roblox.com/asset/?id=00000"
				local hat = nil 
				hat = ss:WaitForChild("hat"):Clone()
			local hum = character:WaitForChild("Humanoid")
			hum:AddAccessory(hat)
		end 
	end)
end)

1 answer

local ss = game:GetService("ServerStorage")
local Teams = game:GetService'Teams'

game.Players.PlayerAdded:Connect (function(player) 
	player.CharacterAdded:Connect (function (character)
		if player.Team == Teams.Barista then

			local shirt = character:WaitForChild("Shirt", 5)
			local pants = character:WaitForChild("Pants", 5)
		

			if shirt and pants then -- pretty sure avatars can be made without clothes
				shirt.ShirtTemplate = "000000" -- pretty sure just need id not link
				pants.PantsTemplate = "00000"
			else
				Instance.new('Shirt', character).ShirtTemplate = '000000'
				Instance.new('Pants', character).PantsTemplate = '00000'
			end
		

			local hat = nil 
			hat = ss:WaitForChild("hat"):Clone() 
			local hum = character:WaitForChild("Humanoid")
			hum:AddAccessory(hat)

		elseif player.Team == Teams.Customer then -- if not barista then check for customer

-- give customer clothing (can be same as Barista with dif id)

		end
	end)
end)

{"mode":"full","isActive":false}

2 comments

0

I tried it and it worked! But if the player switches team it won't change the outfit

0

use team.playeradded or getpropertychangedsignal i think also works [for both just run same code again] or just respawn character

This discussion is preserved as it was. New answers, comments, and votes are closed.