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

This size change script isnt working when the random number is 2?

I am trying to make a script where something random happens. On the first part the game has a chance of making the baseplate ice and slippery but for the second part im trying to make it so the character increases in size but it does not seem to work. This is my script:

local baseplate = workspace.Baseplate
local originalProps = baseplate.CustomPhysicalProperties
local RandomNumber = math.random (2,2)



if RandomNumber == 1 then
	print("1")
	game.Workspace.Baseplate.Material = "Ice"
	baseplate.CustomPhysicalProperties = PhysicalProperties.new(
	originalProps.Density,
	0, -- Friction,
	originalProps.Elasticity,
	100, -- Friction weight
	originalProps.ElasticityWeight)
	game.Workspace.Baseplate.CustomPhysicalProperties.FrictionWeight = 100
	
end

if RandomNumber == 2 then
	print ("2")
	local Character = game.Players
	local Humanoid = Character.PlayerAdded:FindFirstChild("Humanoid")
	for i,Child in pairs (Humanoid:GetChildren()) do
		if Child.Name == 'BodyDepthScale' then
			Child.Value = 1			
		elseif Child.Name == 'HeadScale' then
			Child.Value = 1
		elseif Child.Name == 'BodyHeightScale' then
			Child.Value = 1
		elseif Child.Name == 'BodyWidthScale' then
			Child.Value = 1
		end
	end
end

2 answers

Your error can be found in line 22. You are trying to get the Humanoid from the Player not the character. Humanoid is a child of the character.

hey you! have you ever heard of enes? if you are in trouble, better call enes!

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