Player size won't increase

I have attached a script below which is supposed to change a player’s size, it doesn’t. The loop works and I encounter no errors but the size will not increase. Solution?

while true do
	local player = game.Players.LocalPlayer
	local humanoid = script.Parent:WaitForChild("Humanoid")

	if humanoid then
		humanoid.HeadScale.Value *= 2
		humanoid.BodyDepthScale.Value *= 2
		humanoid.BodyWidthScale.Value *= 2
		humanoid.BodyHeightScale.Value *= 2
	end
	
	wait(1)
end

The script is a localscript, player size cannot be changed on the client.
If you want to change the playerscale then that needs to be done on the server like so:

--// ServerScriptService //

local players = game:GetService('Players')

players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(model)
		spawn(function()
			local humanoid = model.Humanoid
			while task.wait(1) do
				humanoid.HeadScale.Value *= 2
				humanoid.BodyDepthScale.Value *= 2
				humanoid.BodyWidthScale.Value *= 2
				humanoid.BodyHeightScale.Value *= 2
			end
		end)
	end)
end)
4 Likes

If you want to attach the script to a part:

local part = script.Parent
local canTouch = true

part.Touched:Connect(function(hit)

	if canTouch then
		canTouch = false
		print(hit)
		if hit.Parent:FindFirstChild("Humanoid") then
			local humanoid = hit.Parent:FindFirstChild("Humanoid")
			humanoid.HeadScale.Value *= 2
			humanoid.BodyDepthScale.Value *= 2
			humanoid.BodyWidthScale.Value *= 2
			humanoid.BodyHeightScale.Value *= 2
		end

		task.wait(1)
		canTouch = true
	end
end)
1 Like

Thank you! Silly oversight by me then. Will remember for the future!

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