Avatar Changer Script Roblox May 2026
Sometimes, you don't want to just change the shirt; you want to turn the player into a Rock, a Car, or a Custom NPC. This is often called a "Morph."
In this scenario, the script is slightly different. You usually have a Model of the character you want to be, and you clone the Head and Torso of that model onto the player.
Here is a simplified logic for a "Copycat" Morph script:
local morphModel = script.Parent -- Assume this script is inside the Model you want to copy (e.g., a Ninja)script.Parent.Touched:Connect(function(hit) local character = hit.Parent local humanoid = character:FindFirstChild("Humanoid")
if humanoid then -- Loop through the Morph Model's children for _, part in pairs(morphModel:GetChildren()) do if part:IsA("BasePart") then -- Check if the player has a part with the same name local charPart = character:FindFirstChild(part.Name) if charPart then -- Update the Appearance (Color, Material, Mesh) charPart.Color = part.Color charPart.Material = part.Material -- If the part has a special mesh, copy that too! if part:FindFirstChild("Mesh") then part.Mesh:Clone().Parent = charPart end end end end end
end)
(Note: Real morphs usually involve replacing the entire Character Model, but the logic above helps you understand how to manipulate parts individually!)
local ReplicatedStorage = game:GetService("ReplicatedStorage") local apply = ReplicatedStorage.ApplyAvatarEvent
script.Parent.MouseButton1Click:Connect(function() apply:FireServer("Red") end)
In Roblox, the player character is a Model named after the player. To change the avatar, the script must access the Player object and modify the Character model or its descendants.
There are two primary methods for changing an avatar:
Delete the default print("Hello world!") and paste this in:
local changePart = script.Parent local Debris = game:GetService("Debris")-- This function runs when a player touches the part local function onChangeTouch(otherPart) -- 1. Check if the thing that touched us is a Humanoid local character = otherPart.Parent local humanoid = character:FindFirstChild("Humanoid") avatar changer script roblox
if humanoid then -- 2. Get the HumanoidDescription -- This object stores all the info about an avatar (Hair, Face, Shirt, etc.) local description = Instance.new("HumanoidDescription") -- 3. Customize the new look! -- You can find these IDs in the Roblox Creator Store URL description.Shirt = 6263445029 -- Example: A cool shirt ID description.Pants = 6263445135 -- Example: Matching pants ID description.Face = 398916892 -- Example: A new face -- 4. Apply the description to the humanoid humanoid:ApplyDescription(description) print("Avatar changed successfully!") -- Optional: Make the part non-collidable for a second so they don't spam-change changePart.CanCollide = false task.wait(1) changePart.CanCollide = true endend
-- Connect the function to the Touched event changePart.Touched:Connect(onChangeTouch)
There are two main approaches developers use: Sometimes, you don't want to just change the
HumanoidDescription is generally preferred for cosmetic-only changes because it’s safer and respects Roblox’s avatar system.
This method destroys the current character model and replaces it with a pre-existing model from the game files (often stored in ServerStorage or ReplicatedStorage).
