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 make the X grow instead of Y or Z?

How do i make it so that only the X is growing not the Y or Z

for i = 1,25 do
	local x = script.Parent
	x.size = Vector3.new()
	wait(.05)
end

2 answers

✓ Accepted answer

You can add the Vector3, Vector3 are the X, Y & Z properties, it can handle Rotation, Size & Position. (and "size" needs to be Capitalized: "Size") use this instead:

for i = 1,25 do
    local x = script.Parent
    x.Size = x.Size + Vector3.new(1, 0, 0)
    wait(.05)
end

You're Welcome. :)

Simple, keeping in mind that Vector3.new returns the X, Y, and Z axes of an object, just focus on changing the X axis while leaving the others be. You could do this by adding vectors (also make sure you're using Size, not size. Lua is case sensitive, and looks at Size and size being two different variables).

local x = script.Parent

for i = 1,25 do
	x.Size = x.Size + Vector3.new(1,0,0) -- The part's current size, plus a new size with only it's X property changed
	wait(0.5)
end

Or you could just change the size by completely overwriting it each time, like so:

for i = 1,25 do
	x.Size = Vector3.new(i, x.Size.Y, x.Size.Z) -- Keep in mind you'll need to pass it's current size for it's Y and Z axis, since we're overwriting it in the same instruction.
	wait(0.5)
end

Hope that helped, let me know if you have any questions.

1 comment

0

Had to one up me.

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