Hello, I was wondering how I would be able to make it so that when a player is on a certain team they load certain clothes on them.
COMMUNITY QUESTION
How do you force players to wear certain clothes?
2 answers
Note that you will have to replace workspace.Player1 with: workspace:FindFirstChild(player.Name) player is your player. The codes comments explain it:
shirt = workspace.Player1:FindFirstChildOfClass("Shirt") --Getting the players shirt
if not shirt then --If the shirt does not exist
shirt = Instance.new("Shirt") --Create a new one
shirt.Parent = workspace.Player1
end
shirt.ShirtTemplate = "shirt"--Setting what the shirt looks like, example: http://www.roblox.com/asset/?id=382537084
pants = workspace.Player1:FindFirstChildOfClass("Pants") --Getting the players pants
if not pants then --If the pants do not exist
pants = Instance.new("Pants") --Create a new one
pants.Parent = workspace.Player1
end
pants.PantsTemplate = "pants"--Setting what the pants looks like, example: http://www.roblox.com/asset/?id=398635336
Inside a > localscript
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Shirt = Character:FindFirstChild("Shirt") or Instance.new("Shirt", Character) -- if its in character then get shirt else make a new one
local Pants = Character:FindFirstChild("Pants") or Instance.new("Pants", Character)
local shirtId = 0 -- put the shirt id here
local pantsId = 0 -- put the pants id here
Shirt.ShirtTemplate = "rbxassetid://"..shirtId -- set the shirt
Pants.PantsTempalte = "rbxassetid://"..pantsId -- set the pants
This discussion is preserved as it was. New answers, comments, and votes are closed.
