while true do wait (1) game.workspace.Part3.size.vector3.new(22,23,26) ---It says the error is in here ? wait (1) game.workspace.Part3.size.vector3.new(22,24,26) wait (1) game.workspace.Part3.size.vector3.new(22,25,26) wait (1) game.workspace.Part3.size.vector3.new(22,26,26) end Sorry im a noob scripter D:
Why does this script not work ?
4 answers
All the suggestions that Kozero made are worth noting, but I think there is a more fundamental problem with the code that you wrote, neonyayaunbanner - we all have to start somewhere!
I notice that you are incrementing the y-axis Position of Part3 by 1 every 1 second, and there is a nicer way to do this that is much more flexible, namely, use a variable to adjust the offset incrementally!
yOffset = 0 --The initial offset
increment = 1 --How much it goes up by each time
timeBetween = 1 --The delay between moving it
part = game.Workspace.Part3
while wait(timeBetween) do
part.Position = Vector3.new(22, 23 + yOffset, 26)
yOffset = yOffset + increment
end
However, whilst this is much more flexible, it will make the brick go up indefinitely (forever), but you can change that easily by adding in another condition to the while loop:
while wait(timeBetween) and yOffset < 3 do
I hope that helps!
When you are using Vector3.new() you can't just say:
game.workspace.Part3.size.vector3.new(22,23,26)
Instead you should do this:
game.workspace.Part3.size = Vector3.new(22,23,26)
Hopes that teach you something, but else duckwit's answer is the proper way to do it.
function cycle()
while true do
--Put inside the resizes, of Vector3.
end
end
cycle()
I'd say the most efficient way to make it, is within a function.
- Lua is case-sensitive, meaning
game.workspaceis different thangame.Workspace - Roblox made
Workspacea global variable to refer to the Workspace - To edit a property, you use the
=operator to set values
while true do wait(1)
-- Notice capitalization (i.e. Size, Vector3)
Workspace.Part3.Size = Vector3.new(22, 23, 26)
-- I'd put the wait function on a new line, although your way is also fine
wait(1)
Workspace.Part3.Size = Vector3.new(22, 24, 26)
wait(1)
Workspace.Part3.Size = Vector3.new(22, 25, 26)
wait(1)
Workspace.Part3.Size = Vector3.new(22, 26, 26)
end
This discussion is preserved as it was. New answers, comments, and votes are closed.
