How can i make it if you press a gui then it changes your character?
You are too imprecise, do you want to just change simple stuff like shirt or pants of the character? Do you want to change their avatar to an avatar of another player?
Yes, the whole avatar with accessories
Thwn the Player.CharacterAppearanceId property will help you. Just set it to the UserId of the desired user, and resrt/load the character
Not sure about R15, but for R6 rigs you can removeAccessories
and CharacterRig
s and clone in your own. You can then change the values in Body Colors
and Clothing
. Hope this helps!
You can use humanoid descriptions to alter the appearance of an avatar - HumanoidDescription | Documentation - Roblox Creator Hub
To apply a humanoid description to a humanoid you would have to use the Humanoid’s ApplyDescription method like so
Humanoid:ApplyDescription(HumanoidDescription)
As for the gui pressed part you can use its MouseButton1Click
event.
That’s not what im asking, what im asking is how can i make it only click of a gui.
So first, you need an image/text button and listen for MouseButton1Click. Next, set up a RemoteEvent since this kind of stuff can only be done on the server.
-- CLIENT
local button = script.Parent -- define your image/text button
local remote = game.ReplicatedStorage.RemoteEvent -- can be anywhere you want
button.MouseButton1Click:Connect(function()
local desiredPlayerName = 'shedletsky' -- change this to whatever you want.
remote:FireServer(desiredPlayerName)
end)
^ Place this local script inside the button.
You can use Humanoid:ApplyDescription() to change the character’s appearance. To get the correct humanoid description, you can use game.Players:GetHumanoidDescriptionFromUserId() to get their appearance from their userid. And to get their userid, you can use game.Players:GetUserIdFromNameAsync(). This is quite a handful, but all you need is the person’s username.
Place a server script inside ServerScriptService and write the following:
-- SERVER
local event = game.ReplicatedStorage.RemoteEvent -- define your remote again
event.OnServerEvent:Connect(function(plr, desiredPlayerName)
local char = plr.Character
if not char then return end
local userId = game.Players:GetUserIdFromNameAsync(desiredPlayerName)
if not userId then return end -- if player name is invalid
local description = game.Players:GetHumanoidDescriptionFromUserId(userId)
char.Humanoid:ApplyDescription(description)
end)
And that’s it. Customize to your liking. Feel free to ask questions if you’re confused
Thanks a lot! this will be so useful.