Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you force players to wear certain clothes?

Asked by 8 years ago

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.

2 answers

Log in to vote
0
Answered by 8 years ago
Edited 8 years ago

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
Ad
Log in to vote
0
Answered by 8 years ago

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

Answer this question