Why it said " attempt to index nil with 'Size' "?

I try to change the size of my player with a script

I would like to know why it said
szqsd
at the line 13

Before:
sqdzsssqz

After:
sqzdsq

As u can see only “UpperTorso” changed is size but not the “RightUpperLeg”,
yet they have the same script and the same properties.

Any help would be appreciated !

1 Like

Two thing to mention. Firstly, when getting the character, you should also use player.CharacterAdded:Wait() as the character could be nil when the script first runs (however, it appears your script is located under the character, so you could just do script.Parent to get the character).

Secondly, instead of using FindFirstChild, use WaitForChild for your variables.

Try using this code for your script

local char = script.Parent
local humanoid = char:WaitForChild("Humanoid")

local cc1 = char:WaitForChild("UpperTorso")
local cc2 = char:WaitForChild("RightUpperLeg")

cc1.Size = Vector3.new(4.068, 5.122, 4.24)
cc2.Size = Vector3.new(2.438, 4.017, 2.316)
3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.