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

Trying to solve floating head on scaling R6 players non-linearly?

Asked by 3 years ago
Edited 3 years ago

I did try to look this up but this seems to be one of those topics that neither seems to be solved or talked about.

My goal for scripting is to make the R6 body bigger but keep the head the same size as its default size.

I discovered a script inside a morph that almost achieves my goal, the only issue is that it basically makes you larger evenly in all directions, basically scaled up versions of the default.

I want to try to make thin and tall, or stocky and short characters, and I modified the script to try and achieve a character size of (1,1.5,1)

My picture of my progress: Picture of A, B and C. It’s a Gyazo link.

A is the default. B is what I’m trying to go for. C is what happens after I modified the script to achieve the closest result to the goal.

This is the script: Pastebin, something seemed to go wrong on pasting it in the typical coding block. EDIT: Someone fixed it.

local Percentage = 1 -- 1 = normal, 0.5 = half your normal size, 2 = double your normal size
local NewPercentage = Vector3.new(1,1.5,1)

local FixedPercentage = Vector3.new(1, 1/1.5,1)
local HeadPercentage = Vector3.new(1,1.5,1)
local LastGrowth = 0
local HumanoidTable = { ["Head" ] ="Head"}

script.Parent.Touched:Connect(function(Hit)
    if time() - LastGrowth > 1 then
        LastGrowth = time()

        local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)

        if Player and Player.Character:FindFirstChild("AppliedGrowth") == nil then
            local Motors = {}
            local NewMotors = {}
            local NewVal = Instance.new("BoolValue")
            NewVal.Name = "AppliedGrowth"
            NewVal.Parent = Player.Character


            for i,v in pairs(Player.Character.Torso:GetChildren()) do
                if v:IsA("Motor6D") then
                    table.insert(Motors, v)
                end
            end
            table.insert(Motors, Player.Character.HumanoidRootPart.RootJoint)

            local HatWelds = {}
            for i,v in pairs(Player.Character:GetChildren()) do
                if v:IsA("Accessory") then
                    v.Handle.AccessoryWeld.C0 = CFrame.new((v.Handle.AccessoryWeld.C0.p * Percentage)) * (v.Handle.AccessoryWeld.C0 - v.Handle.AccessoryWeld.C0.p)
                    v.Handle.AccessoryWeld.C1 = CFrame.new((v.Handle.AccessoryWeld.C1.p * Percentage)) * (v.Handle.AccessoryWeld.C1 - v.Handle.AccessoryWeld.C1.p)
                    table.insert(HatWelds, {v.Handle.AccessoryWeld:Clone(), v.Handle})
                    v.Handle.SpecialMesh.Scale = v.Handle.SpecialMesh.Scale * Percentage
                end
            end

            for i,v in pairs(Motors) do

                local X, Y, Z, R00, R01, R02, R10, R11, R12, R20, R21, R22 = v.C0:components()

                X = X * 1
                Y = Y *1.5
                Z = Z * 1

--              --
--              R00 = R00 * Percentage
--              R01 = R01 * Percentage
--              R02 = R02 * Percentage
--              --
--              R10 = R10 * Percentage
--              R11 = R11 * Percentage
--              R12 = R12 * Percentage
--              --
--              R20 = R20 * Percentage
--              R21 = R21 * Percentage
--              R22 = R22 * Percentage
--              
                v.C0 = CFrame.new(X, Y, Z, R00, R01, R02, R10, R11, R12, R20, R21, R22)

                local X, Y, Z, R00, R01, R02, R10, R11, R12, R20, R21, R22 = v.C1:components()
                X = X * 1
                Y = Y * 1.5
                Z = Z * 1

--              --
--              R00 = R00 * Percentage
--              R01 = R01 * Percentage
--              R02 = R02 * Percentage
--              --
--              R10 = R10 * Percentage
--              R11 = R11 * Percentage
--              R12 = R12 *Percentage
--              --
--              R20 = R20 * Percentage
--              R21 = R21 * Percentage
--              R22 = R22 * Percentage
                v.C1 = CFrame.new(X, Y, Z, R00, R01, R02, R10, R11, R12, R20, R21, R22)

                table.insert(NewMotors, {v:Clone(), v.Parent})
                v:Destroy()
            end
            for i,v in pairs(Player.Character:GetChildren()) do

                if v:isA("BasePart") then
                    if  HumanoidTable[v.Name] == nil then
                    v.Size  = v.Size*NewPercentage
                    end

                    if  HumanoidTable[v.Name] ~= nil then
                        v.Size  = v.Size*HeadPercentage
                        Player.Character.Head.Size = Player.Character.Head.Size*FixedPercentage
                end

                end




            for i,v in pairs(NewMotors) do
                v[1].Parent = v[2]
            end

                for i,v in pairs(HatWelds) do
                v[1].Part1 = Player.Character.Head
                v[1].Parent = v[2]
            end
        end
    end
    end
end)

I’m rookie-ish with coding, so I apologize for any possible lack of explanation or documentation.

I can provide the morph that I found to have the unmodified version of this script (Kudos to hunxrepair for making the thing)

0
I just added your script on the code block Leamir 3138 — 3y
0
Thank you, it didn't look right when I looked at "Preview", I guess you fixed that somehow. sonicvsmaio4 4 — 3y
0
That's for R15, and that thread did not achieve a solution. sonicvsmaio4 4 — 3y

Answer this question