Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does this script not work ?

Asked by 10 years ago

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:

4 answers

Log in to vote
0
Answered by
duckwit 1404 Moderation Voter
10 years ago

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!

Ad
Log in to vote
0
Answered by 10 years ago

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.

Log in to vote
0
Answered by 10 years ago
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.

Log in to vote
0
Answered by
Ekkoh 635 Moderation Voter
10 years ago
  1. Lua is case-sensitive, meaning game.workspace is different than game.Workspace
  2. Roblox made Workspace a global variable to refer to the Workspace
  3. 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

Answer this question