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

Help with growing part (ClickDetectors)?

When I click a part, I want a part's size to grow until the size reaches 20,20,20. (JUTS KEEPS GROWING).

Also, when I click on the part, the gui does not pop up.

game.Players.PlayerAdded:connect(function(plr)
	d = true
	
	script.Parent.ClickDetector.MouseClick:connect(function()
		if d == true then
			d = false

			while true do
				local X = script.Parent.Parent.Parent.Block.Part.Size.X
				local Y = script.Parent.Parent.Parent.Block.Part.Size.Y
				local Z = script.Parent.Parent.Parent.Block.Part.Size.Z
				script.Parent.Parent.Parent.Block.Part.Size = Vector3.new(X+.1,Y+.1,Z+.1)
				wait()
				if script.Parent.Parent.Parent.Block.Part.Size = Vector3.new(20,20,20) then
					break
				end
			end	
			
			local Gui = script.Parent.Gui
			Gui:Clone().Parent = plr.PlayerGui
			wait(2)
			plr.PlayerGui.Gui:remove()
			d = true
		end
	end)
end)

1 answer

✓ Accepted answer

For the part to grow to 20 in all the axis in size it's:


local sp = script.Parent -- Get the part.

local click = Instance.new("ClickDetector", sp) -- Create and parent the ClickDetector

sp.ClickDetector.MouseClick:connect(function() -- Event MouseClick for the ClickDetector
	for i = 1,20, 0.01 do -- A simple for i loop that goes from 1 to 20 with 0.01 jumps.
		wait() -- Put a wait, for the loop to count smoothly from 1 - 20.
		sp.Size = Vector3.new(i, i, i) -- Just replace the XYZ with the i which is 1-20 with 0.01's.
	end
end)

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