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

My root part size keeps changing from fat to skinny with the same stats, how do I fix this?

Asked by
popeeyy 493 Moderation Voter
6 years ago
Edited 6 years ago

When this loads in the stats on the Humanoid, with the same numbers, sometimes I'm fat and sometimes I'm skinny. How do I fix this?

function addweight(h,s,n)
    local pf= stats:WaitForChild(n)
    h.BodyDepthScale.Value=s
    h.BodyWidthScale.Value=s
    h.BodyHeightScale.Value= pf.Height.Value
    pf.Size.Value= h.BodyDepthScale.Value

end

game.Players.PlayerAdded:Connect(function(plr)  
    local pf= nil
    if stats:FindFirstChild(plr.Name) == nil then
             pf= script.plr:clone()
        pf.Parent=stats
        pf.Name= plr.Name
        end
    pf.StatsLoad.Value=false
    plr.CharacterAdded:connect(function(char)


        print("char")
        pf:WaitForChild("StatsLoad")
        pf.StatsLoad.Value=false

    wait()

    if stats:FindFirstChild(plr.Name) ~= nil then

        repeat wait() until continue
        continue=false
        print("stats load")
        if pf.Durability.Value < 100 then
            pf.Durability.Value = 100
        end
        if pf.Head.Value < 0.94999998807907104492 then
            pf.Head.Value= 0.94999998807907104492
        end
    plr.Character.Humanoid.WalkSpeed= pf.Speed.Value

        plr.Character.Humanoid.BodyHeightScale.Value= pf.Height.Value
        plr.Character.Humanoid.HeadScale.Value= pf.Head.Value

        plr.Character.Humanoid.BodyDepthScale.Value= pf.Size.Value


        plr.Character.Humanoid.BodyWidthScale.Value= pf.Size.Value

        pf.StatsLoad.Value=true

        addweight(plr.Character.Humanoid, pf.Size.Value, plr.Name)

        wait()


        plr.Character.Humanoid.MaxHealth= pf.Durability.Value
        plr.Character.Humanoid.Health= plr.Character.Humanoid.MaxHealth
        update:FireClient(plr, pf.Durability, pf.Strength)
        update2:InvokeClient(plr, pf.Durability.Value, pf.Strength.Value, pf.Height.Value, pf.Speed.Value)
        print("loaded all stats")


    end
    end)

Answer this question