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

how do i clone my self with a key?'

Asked by 5 years ago
Edited 5 years ago

ok so i want to clone my self by presing a key lets say Q how do i do it??

1 answer

Log in to vote
0
Answered by
SmartNode 383 Moderation Voter
5 years ago

I highly assume that you want that clone to be replicated. So here's my answer:

Stage 1 - Setup

  • Put a RemoteEvent called "PlayerClone" in ReplicatedStorage

  • Put a LocalScript called "CloneHandler" in StarterCharacterScripts located in StarterPlayer

  • Put a Script called "CloneStarter" in ServerScriptService

Stage 2 - LocalScript

--[ Configuration ]--
Key = Enum.KeyCode.Q
Interval = 0.5 --> Put 'false' if you don't want a delay between each clone, otherwise intervals are counted in seconds.


--[ Core Script ]--
PlayerClone = game.ReplicatedStorage.PlayerClone
UIS = game:GetService("UserInputService")
Waiting = false

UIS.InputBegan:Connect(function(KeyPressed)

    if not Interval then

        Interval = 0

    end

    if not Waiting then

        Waiting = true

        --

        if KeyPressed.KeyCode == Key then

            print('Fired!')
            PlayerClone:FireServer()

        end

        --

        wait(Interval)

        Waiting = false

    end

end)

Stage 3 - Script

--[ Core Script ]--
PlayerClone = game.ReplicatedStorage.PlayerClone

PlayerClone.OnServerEvent:Connect(function(plr)

    print('Got Signal!')

    local function Clone(plr)

        local Player = Instance.new('Model')
        Player.Parent = plr.Character.Parent
        Player.Name = plr.Name

        for _, object in pairs(plr.Character:GetChildren()) do

            local _ = object:Clone()
            _.Parent = Player

        end

    end

    Clone(plr)


end)

You're done!

Ad

Answer this question