Every 1 sec 1 size

my script this not working:

wait(1) game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local Humanoid = Character:WaitForChild(‘Humanoid’)
for i,Child in pairs(Humanoid:GetChildren()) do
if Child.Name == ‘BodyDepthScale’ then
Child.Value = 0.5
elseif Child.Name == ‘HeadScale’ then
Child.Value = 0.5
elseif Child.Name == ‘BodyHeightScale’ then
Child.Value = 0.5
elseif Child.Name == ‘BodyWidthScale’ then
Child.Value = 0.5
end
end
end)
end)

“every 1 sec = 1 size player”

I, uh… Hmm…


You seem to want the player to scale up a bit every one second. Use a while loop for that. There is also a chance for the PlayerAdded event to not fire in Studio, so add a longer wait, then remove it when the script is done.

1 Like
game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		local Humanoid = Character:WaitForChild('Humanoid')
		while wait(1) do 
			for i,Child in pairs(Humanoid:GetChildren()) do
				if Child.Name == 'BodyDepthScale' then
					Child.Value += 0.5
				elseif Child.Name == 'HeadScale' then
					Child.Value += 0.5
				elseif Child.Name == 'BodyHeightScale' then
					Child.Value += 0.5
				elseif Child.Name == 'BodyWidthScale' then
					Child.Value += 0.5
				end
			end
		end 
	end)
end)
1 Like

You also forgot to make the = to +=, = means you’re setting it to .5, while += means you’re adding it to whatever value it already is

1 Like

Improved @crazycarkids’s script:

local scaleitems = {"BodyDepthScale","HeadScale","BodyHeightScale","BodyWidthScale"}
game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		local hum = char:WaitForChild("Humanoid")
		while task.wait(1) and char.Parent do
			for _, obj in pairs(hum:GetChildren()) do
				if table.find(scaleitems, obj.Name) then
					Child.Value += 0.5
				end
			end
		end
	end)
end)

Keep his post as the solution, though. It is indeed a solution.

1 Like

Yes checking for char.Parent and task.wait() are both better, while also allowing the while loop to be stopped

1 Like

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