Key Press after morph script

  1. What do you want to achieve?

I have a script that when touched, it morphs you into another character. The character has preset tools that are all clumped into one hand when you first morph. I want the tools to not be in his hand and a simple solution is to add a key press of the number 1 into the script after the morph.

  1. What is the issue?

I have tried adding key presses into the script but the script either breaks or the key press 1 does not work.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I have found a lot of information about how to detect key presses. But can’t find any information on how to make a script press the 1 key. Below is an example of the morph script. At the end I need it to press 1.


local pad = script.Parent
local characterName = "maleelf1"
local character = pad.Parent:WaitForChild(characterName)
 
local debounce = true
pad.Touched:Connect(function(obj)
    local plr = game.Players:GetPlayerFromCharacter(obj.Parent)
    if plr and debounce == true then
        debounce = false
       
        pad.BrickColor = BrickColor.new("Really red")
       
        local charClone = character:Clone()
        charClone.Name = plr.Name
        plr.Character = charClone
       
        local rootPart = charClone:FindFirstChild("HumanoidRootPart") or charClone:FindFirstChild("Torso")
        local plrRoot = obj.Parent:FindFirstChild("HumanoidRootPart") or obj.Parent:FindFirstChild("Torso")
       
        if rootPart and plrRoot then
            rootPart.CFrame = plrRoot.CFrame
        end
       
        charClone.Parent = workspace
       
        wait(2.5)
       
        pad.BrickColor = BrickColor.new("Lime green")
        debounce = true
    end
end)

You cant clone a player’s character, but you can create a character.
Check this:

The morph script works perfect. I just need it to press 1. But I will check out your script as well and see if it works better.

You can clone a player’s character? Roblox sets the Archivable property to false on the character model…

Your code is fine, the problem is that the model/part Archivable property is false, set it to true before cloning the character. (And you can set it off after cloning the character)

Here you can learn Archivable easily: Instance | Roblox Creator Documentation

So you are saying if I make it archivable the tools wont appear in my hand?

And also still looking for someone to teach me how to insert a number 1 key press into this script after the cloning process.

I want to learn both.

Thanks