Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to change the character of the player without removing the original character?

Asked by
RedCombee 585 Moderation Voter
10 years ago

To better explain, I know how to change the player's character, but when one does, the original character is removed from the game. I want the player to either shrink (I would prefer this method if possible) or control something else without the removal of the original character.

Current code:

local player = game.Players.LocalPlayer
local playergui = player.PlayerGui
local mouse = player:GetMouse()
local char = player.Character
local emerald = script.Parent
local emeraldEquipped = false
local cam = game.Workspace.CurrentCamera
debounce = false

emerald.Equipped:connect(function()
    emeraldEquipped = true
end)

emerald.Unequipped:connect(function()
    emeraldEquipped = false
end)

mouse.KeyDown:connect(function(key)
    if emeraldEquipped == true then
        key = key:lower()
        if key == "r" then
            if debounce == false then
                debounce = true
                char.Animate:clone().Parent = game.Workspace.Superhero
                player.Character = game.Workspace.Superhero
                cam.CameraSubject = game.Workspace.Superhero.Head
                cam.CameraType = "Follow"
            elseif debounce == true then
                if game.Workspace:FindFirstChild(player.Name) then
                    player.Character = game.Workspace:FindFirstChild(player.Name)
                else
                    player:LoadCharacter()
                end
                debounce = false
            end
        end
    end
end)
0
This is a very difficult to do seamlessly. The idea is you need to clone the original character, and replace it back where it was. But before you clone it, you need to set it's Archivable property to true. Tkdriverx 514 — 10y

Answer this question