generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: What is wrong with this script?

Previous Thread :: Next Thread 
chatowillwin is not online. chatowillwin
Joined: 21 Jan 2014
Total Posts: 8417
30 Aug 2016 08:42 AM
( Beginner scripter here )

I am trying to learn For and While Wait Do, and this script doesn't seem to function



local Part = Instance.new('Part', game.Workspace)

Part.Anchored = true

while wait() do
for y=0, 100, 1 do
Part.Position = (0,y,0)
wait(0.1)
end
for y=0, 100, -1 do
Part.Position = (0,y,0)
wait(0.1)
end

end




Report Abuse
UFAIL2 is not online. UFAIL2
Joined: 14 Aug 2010
Total Posts: 6905
30 Aug 2016 08:47 AM
It's not while wait() do, it's while (condition == true) do.

Issues:
You are not creating a Vector3, but instead are just supping the XYZ as a tuple. It should be Vector3.new(0,y,0).
Your second for loop would be running inf. because you start from 0, are going towards 100, and are counting down. If you flip the 0 and 100 around it should work.
Report Abuse
chatowillwin is not online. chatowillwin
Joined: 21 Jan 2014
Total Posts: 8417
30 Aug 2016 08:49 AM
^ that did not fix anything.


Report Abuse
UFAIL2 is not online. UFAIL2
Joined: 14 Aug 2010
Total Posts: 6905
30 Aug 2016 08:51 AM
Except it does. This worked fine.

local Part = Instance.new('Part', game.Workspace)

Part.Anchored = true

while wait() do
for y=0, 100, 1 do
Part.Position = Vector3.new(0,y,0)
wait(0.1)
end
for y=100, 0, -1 do
Part.Position = Vector3.new(0,y,0)
wait(0.1)
end

end
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image