Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

the body scaling will not change what is the problem?

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)

1 comment

0

Why not local char = plr.Character?

2 answers

-- 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.

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.