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

How can I turn this into a char for a character model in my game?

Asked by 2 years ago

I have this char command that I wrote and I am trying to make it turn the player entered into a character model I made. Heres the script I made that should have it. This is a script that I used from someone else and I am trying to turn it into a model transormation.

local chatservice = require(game:GetService("ServerScriptService"):WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))

script.Fire.Event:Connect(function(player, name, channel, arguments, normalarguments, matchsize)
    local chatspeaker = chatservice:GetSpeaker(name)

    local humanoiddescription = nil

    local success, err = pcall(function()
        humanoiddescription = game:GetService("Players"):GetHumanoidDescriptionFromUserId(game:GetService("Players"):GetUserIdFromNameAsync(arguments[2]))
    end)

    if humanoiddescription ~= nil then
        if player.Character.Humanoid:FindFirstChild("HumanoidDescription") then
            if matchsize == true then
                local pasthumanoiddescription = player.Character.Humanoid.HumanoidDescription
                humanoiddescription.BodyTypeScale = pasthumanoiddescription.BodyTypeScale
                humanoiddescription.DepthScale = pasthumanoiddescription.DepthScale
                humanoiddescription.HeadScale = pasthumanoiddescription.HeadScale
                humanoiddescription.HeightScale = pasthumanoiddescription.HeightScale
                humanoiddescription.ProportionScale = pasthumanoiddescription.ProportionScale
                humanoiddescription.WidthScale = pasthumanoiddescription.WidthScale
            end
        end
    end

    if success then
        player.Character.Humanoid:ApplyDescription(humanoiddescription)
        chatspeaker:SendSystemMessage("Successfully made your character look like "..normalarguments[2].."!", channel)
    else
        chatspeaker:SendSystemMessage("An error occurred, did you provide the correct username? If so, that user might be terminated.", channel)
    end
end)

Answer this question