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

How do I use the size property?

When this GUI's text is "On", make these parts' sizes increase by 6.5. Here is my script:

if game.Workspace.Parent.StarterGui.ScreenGui.TextButton.Text == "On" then
	
	game.Workspace.Part1.Size = game.Workspace.Part1.Size + 6.5
	wait(1)	
	game.Workspace.Part2.Size = game.Workspace.Part2.Size + 6.5
	wait(1)
	game.Workspace.Part3.Size = game.Workspace.Part3.Size + 6.5
	wait(1)
	game.Workspace.Part4.Size = game.Workspace.Part4.Size + 6.5
	wait(1)
	game.Workspace.Part5.Size = game.Workspace.Part5.Size + 6.5
	wait(1)
end

Why does nothing Happed? Please help me. Thank you!

2 answers

✓ Accepted answer

The reason this does not work is because you're adding 6.5 to Size when 6.5 is not a valid member of Size. For adding size to an object, you must also specify its X, Y, and Z axis.

if game.Workspace.Parent.StarterGui.ScreenGui.TextButton.Text == "On" then
    game.Workspace.Part1.Size = game.Workspace.Part1.Size + Vector3.new(6.5, 6.5, 6.5)
    wait(1)
    game.Workspace.Part2.Size = game.Workspace.Part2.Size + Vector3.new(6.5, 6.5, 6.5)
    wait(1)
    game.Workspace.Part3.Size = game.Workspace.Part3.Size + Vector3.new(6.5, 6.5, 6.5)
    wait(1)
    game.Workspace.Part4.Size = game.Workspace.Part4.Size + Vector3.new(6.5, 6.5, 6.5)
    wait(1)
    game.Workspace.Part5.Size = game.Workspace.Part5.Size + Vector3.new(6.5, 6.5, 6.5)
    wait(1)
end

If you want to change it on only 1 or 2 axis, then just turn the 6.5 on the axis you want to change to a 0 and leave the rest alone.

Gui's use the UDIM2 data type, so when setting the size of a GUI you need to set it to a UDIM2.

UDIM2

1 comment

0

He is talking about a part's size, not a GUI's size

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