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

How to make a certain player wear shirts, pants and change face?

Asked by 4 years ago
Edited by JesseSong 4 years ago

I am new to scripting and have tried multiple ways to change a certain player's avatar. In order to get this to work I tried doing this:


local playername = game.Players.LocalPlayer.Name local player = workspace:FindFirstChild(""..playername.."") if player ~= nil then player:FindFirstChild("Pants").PantsTemplate = "http://www.roblox.com/asset/?id=0000000" player:FindFirstChild("Shirt").ShirtTemplate = "http://www.roblox.com/asset/?id=0000000" end end)

Not sure if this is the right way to do it but please revise my code if needed thanks!

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago
local playername = game.Players.LocalPlayer.Name
local player = workspace:FindFirstChild(playername) 
player:FindFirstChild("Pants").PantsTemplate = "http://www.roblox.com/asset/?id=0000000" 
player:FindFirstChild("Shirt").ShirtTemplate = "http://www.roblox.com/asset/?id=0000000"

1.workspace:FindFirstChild(""..playername.."") doesn't make sense because playername is already a string 2.if player ~= nil then is useless 3. At the line 7 end) is useless too because you don't have a function. Example:

part.Touched:Connect(function()
    print("hey")
end)
Ad

Answer this question