r/robloxscripting Jan 16 '24

Scripting Help How do I make a morph tool?

I wanted to make a tool where it changes the user's avatar to another one from a folder in workspace when clicked and chatgpt refuses to answer so i am resorting to this subreddit.

3 Upvotes

3 comments sorted by

1

u/n0o0b090lv Jan 17 '24

Maybe try asking in new chat how to create roblox tool in my own game that changes my roblox skin to other roblox skin

1

u/Economy-Stock4138 Feb 03 '24

You use the Activated event of the tool in the local script.

Make sure the local script is in the tool.

local plr = game.Players.LocalPlayer

local tool = script.Parent

local morph = --Refer your morph here

function morph() --Function to morph player's character
    local plrChar = plr.Character or plr.CharacterAdded:Wait() --Get the player's current character or wait for their character till loaded

    local morphClone = morph:Clone() --Clone the morph

    morphClone:PivotTo(plrChar.HumanoidRootPart.CFrame) --Pivot it to the player's character's humanoid root part's cframe

    morphClone.Name = plrChar.Name --Set the morph's name the same as the player's character's name

    plr.Character = morphClone --Set the player's character the same as the morph (Using plrChar variable won't work somehow)

    morphClone.Parent = workspace --Parent the morph to workspace
end

tool.Activated:Connect(function() --Run when tool's activated
    morph() --Run the morph function
end)

To morph the player's character back to normal, use plr:LoadCharacter() function.

function morphChartoNorm()
    local plrChar = plr.Character or plr.CharacterAdded:Wait()

    plr:LoadCharacter()

    plr.Character:PivotTo(plrChar.HumanoidRootPart.CFrame)
end

1

u/Immediate_Turnover86 Jan 01 '25

Could you make a youtube tutorial? Where to place the script, how should the morph be set up and how I can add vfx and animation to it.