Help - Button presser

I need help when a player presses a button I want to get his character and clone him to make a statue of him (if possible with a inactive animation)

Some example:

I also asked for help but they didn’t work. I tried everything, please help me.

Try using a HumanoidDescription for this.

local Players = game:GetService('Players')

part.Touched:Connect(function(hit)
local player = Players:GetPlayerFromCharacter(hit.Parent) -- get the player who touched the part
if not player then return end -- if the player doesnt exist

local humanoidDesc = Players:GetHumanoidDescriptionFromUserId(player.UserId) -- get the player's humanoid desc
statue.Humanoid:ApplyDescription(humanoidDesc) -- apply the humanoid description
end)

Or you can just clone the player’s character and set the primary part cframe.

1 Like
--Just clone the player and move him to the statue by doing this.

local Part = --location
Part.Touched:Connect(function(plr)
   if plr then
       local char= plr.Character
       local newStatue = char:Clone()
newStatue.Parent = --location here.CFrame * CFrame.new(0, 3, 0)
 end

end)

Thanks, I will make sure to try that.

1 Like

So 1 thing you can try, is using a Touched Event which would handle physics based part interaction with each other, calling GetPlayerFromCharacter() checking if the part touched was a parent of the Character’s Model, then clone it that way:

local Button = script.Parent
local DB = false --Not sure if you want to account for the button being pressed once after a certain interval

Button.Touched:Connect(function(Hit)
    local PlayerCheck = game.Players:GetPlayerFromCharacter(Hit.Parent)

    if PlayerCheck and not DB then
        DB = true
        local Character = Hit.Parent

        Character.Archivable = true --By default, this is set as false so we need to set this as true before cloning it

        local CharClone = Character:Clone()
        CharClone.Parent = workspace
        CharClone:MakeJoints()
        CharClone:SetPrimaryPartCFrame(CFrame.new(Button.Position + Vector3.new(0, 10, 0)))
    end
end)

@Legend_boysYTs There are a couple of issues wrong with your script, I’ll just state them:

  • The Touched event returns back the BasePart, not the plr so you have to refer to the BasePart’s Parent

  • By default, the Character’s Archivable property is set by false which will prevent any cloning from occurring

  • You don’t set the Parent to a CFrame value, set it to the workspace instead

2 Likes

It’s saying “players cannot be cloned”

“never judge a copper by the dust”

have you tried @flkfv’s code yet?

What do you mean “never judge a copper by the dust”?

Yes I’m trying right now it because I didn’t understand really much about humanoid description.

@flkfv’s code didn’t work too as well.

Here this model will do exactly what you described. For the idle animation you need to Anchor the HomanoidRootPart and play any idle animation.

local module = {}
module.__index = module


function module.GetCharacterFromTouch(ClickDetector)
    local Char
    ClickDetector.Clicked:Wait(function(z) hit = z.Character end))
    Char.Archivable = false
    local Character = Char:Clone()
    Character.Animate:Destroy()
    return Character
end

return Module

that script is just straight forward yoinking the Character
but u can just get the Character HumanoidDescription

It is not touched event, it’s a click event

Give me a secound then to fix the code

Here is the map with the button presser thing if you want an example:

yea i know that game i know what u are trying to do now

1 Like

I wanted to make the scripts by myself and I think it does not fits correctly.

Hello?? Is anyone there to help me?