ok hi! so i have a build commission and theyve asked for a gui button that refreshes their roblox clothing so when theyve tried some clothing on and they click the button itll refresh it to what their avatar clothing is! how do i do this as i have no clue!
1 Like
ok thanks! i made this but idk what would go in the function
local player = game.Players.LocalPlayer
appearanceModel.Parent = game.Workspace
script.Parent.MouseButton1Click:Connect(function()
end)```
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:wait()
script.Parent.MouseButton1Click:Connect(function()
local a = game:GetService("Players"):GetCharacterAppearanceAsync(player.UserId)
for _, v in pairs(char:GetChildren()) do
if v:IsA("Accessory") then
v:Destroy()
end
end
for _, v in pairs(a:GetChildren()) do
if v:IsA("Shirt") then
char:FindFirstChildOfClass("Shirt"):Destroy()
v.Parent = char
elseif v:IsA("Pants") then
char:FindFirstChildOfClass("Pants"):Destroy()
v.Parent = char
elseif v:IsA("Accessory") then
v.Parent = char
char.Humanoid:AddAccessory(v)
end
end
a:Destroy()
a = nil
end)
1 Like
will that put the original clothing of the person onto the person?
it will put their current clothing that their wearing on them
1 Like
ok thanks let me try it!! i hope it works!! :)))
1 Like
it has this error:
Players.aesturr.PlayerGui.ScreenGui.TextButton.LocalScript:8: attempt to index nil with 'Destroy'
ok try it now
3000000000000000000000000
it defo works! but when i click it i cant try anything else on after
o it has the same error again dont worry about it
it probably needs time to update from the website
1 Like
Hey, here is a not tested script and maybe it could work and you would learn something!
local Cooldown = 3
local Player = game.Players.LocalPlayer
local AppearenceModel = Player:GetAppearanceAsync(Player.UserId)
script.Parent.MouseButton1Click:Connect(function()
wait(Cooldown + 0.1)
Player.Character = AppearenceModel
print("Appearance Refreshed, to "..Player.Name.." !")
end)