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!
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)