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

the body scaling will not change what is the problem?

Asked by
Plieax 66
6 years ago
this = script.Parent

this.MouseClick:connect(function(plr)
    local char = game.Workspace:WaitForChild(plr.Name)
    plr.leaderstats.Growth.Value = plr.leaderstats.Growth.Value +100
    char.Humanoid.BodyWidthScale.Value = char.Humanoid.BodyWidthScale.Value *2
    char.Humanoid.BodyHeightScale.Value = char.Humanoid.BodyHeightScale.Value*2
    char.Humanoid.BodyDepthScale.Value = char.Humanoid.BodyDepthScale.Value*2
    this.Parent.Parent:Destroy()
end)
0
Why not `local char = plr.Character`? TheeDeathCaster 2368 — 6y

2 answers

Log in to vote
0
Answered by
Zafirua 1348 Badge of Merit Moderation Voter
6 years ago
Edited 6 years ago
-- Declaration Section 
-- //Game Services 
local Workspace = game:GetService("Workspace")

-- //Part Location 
local Part = Workspace:WaitForChild("Part")
local ClickDetector = Part:WaitForChild("ClickDetector")

-- //Variables
local Number = 2

-- Processing Section
local function ChangeHumanoidProperties (Player)
    local PlayerName = Workspace:WaitForChild(Player.Name)
    print(PlayerName)
    local Humanoid = PlayerName:WaitForChild("Humanoid")
    print(Humanoid)

    Humanoid.BodyWidthScale.Value = Humanoid.BodyWidthScale.Value * Number
    Humanoid.BodyHeightScale.Value = Humanoid.BodyHeightScale.Value * Number
    Humanoid.BodyDepthScale.Value = Humanoid.BodyDepthScale.Value * Number
end

-- Connecting Section 
Part.ClickDetector.MouseClick:Connect(ChangeHumanoidProperties)

What I did differently

  • I used the Part to connect with the Click Detector
  • I used WaitForChild() for Humanoid
  • No Magic Numbers in your code; i.e, declared value.

Make sure that the Character is R15 and not R6. Scaling feature is not available for R6.

Thats about it. Let me know if the error still persists.

Ad
Log in to vote
0
Answered by
PlaasBoer 275 Moderation Voter
6 years ago
Edited 6 years ago

I think it is because you using wrong humanoid rig type.

So there are two types of character rig one is R6 he older and the newer on R15

The R6 Rig doesn't have scaling properties only the R15 Rig has that.

What you should do is set game settings to make only R15 allowed

Scroll to game setting it show how to set the game to R15 only https://wiki.roblox.com/index.php?title=R15_Compatibility_Guide

Exstra info http://wiki.roblox.com/index.php/API:Class/Humanoid

And make sure there is no error in code.

Answer this question