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 » Scripting Helpers
Home Search
 

Re: Please fix this script.

Previous Thread :: Next Thread 
radzan is not online. radzan
Joined: 13 Jun 2010
Total Posts: 692
22 Dec 2012 11:33 AM
This is a script that continualy changes the celocity of a brick.
N = script.Parent
Z = Velocity.Z
N[Z]= N[Z]+20
wait(50)
N[Z] = N[Z]-20
wait(20)
N[Z] = N[Z]-20
wait(50)
N[Z] = N[Z]+20
Report Abuse
blackboy167thst is not online. blackboy167thst
Joined: 22 Jul 2011
Total Posts: 2468
22 Dec 2012 11:39 AM
N = script.Parent
Z = N.Velocity.Z
Z = Z + 20
wait(50)
Z = Z - 20
wait(20)
Z = Z - 20
wait(50)
Z = Z + 20

~ вℓα¢квσу167тнѕт, тєн вєѕт єνα. ∂υηт мєѕѕ ωιт тєн ρяσ. ~
Report Abuse
TheAwesomenessDude is not online. TheAwesomenessDude
Joined: 17 Jul 2011
Total Posts: 11602
22 Dec 2012 11:50 AM
@blackboy

That would not function the way you want it to, because it would change the value of the variable, not the velocity. This is why you can't set variables to specific properties.

Z = Z+20 will set the variable called "z" to 20, not the Z-axis velocity of the part.
Report Abuse
radzan is not online. radzan
Joined: 13 Jun 2010
Total Posts: 692
22 Dec 2012 02:14 PM
Dosen't work.
Report Abuse
Kondou is not online. Kondou
Joined: 05 Aug 2012
Total Posts: 1148
22 Dec 2012 02:17 PM
While true do
n = script.Parent
n.Velocity = math.random(-20,20)
wait(20)

I think that would work too.
Report Abuse
radzan is not online. radzan
Joined: 13 Jun 2010
Total Posts: 692
22 Dec 2012 02:20 PM
Wouldn't that be random instead of organised?
Report Abuse
Kondou is not online. Kondou
Joined: 05 Aug 2012
Total Posts: 1148
22 Dec 2012 02:23 PM
Yeah it would go anywhere from -20 to 20, did I misunderstand how you wanted to do that? Sorry let me see if I can come up with something that will only do -20 and 20.
Report Abuse
Kondou is not online. Kondou
Joined: 05 Aug 2012
Total Posts: 1148
22 Dec 2012 02:25 PM
While true do
n = script.Parent
n.Velocity = -20
wait(20)
n.Velocity = 20
wait(20)

There, now it should do -20, wait 20 seconds, do 20, wait 20 seconds, then loop back up to the top? If it doesn't work, I'd love if someone explained why. I'm only learning scripting slowly.
Report Abuse
Kondou is not online. Kondou
Joined: 05 Aug 2012
Total Posts: 1148
22 Dec 2012 02:28 PM
Oh, don't capitalize while.

Also, I just noticed the script won't work. Which way do you want it to move the brick? The velocity has X,Y,and Z
Report Abuse
Kondou is not online. Kondou
Joined: 05 Aug 2012
Total Posts: 1148
22 Dec 2012 02:30 PM
Ignore my silly rambling above. Here is what I got now, works too.

while true do
n = script.Parent
n.Velocity = Vector3.new(-20,0,0)
wait(20)
n.Velocity = Vector3.new(20,0,0)
wait(20)
end
Report Abuse
shayan414 is not online. shayan414
Joined: 11 Aug 2008
Total Posts: 8090
22 Dec 2012 03:04 PM
@kondou I believe he wants the values to go in a specific order instead of randomly.
Report Abuse
Kondou is not online. Kondou
Joined: 05 Aug 2012
Total Posts: 1148
22 Dec 2012 03:06 PM
Then my newest script should do the job, right?
Report Abuse
shayan414 is not online. shayan414
Joined: 11 Aug 2008
Total Posts: 8090
22 Dec 2012 03:09 PM
Yeah I believe thats what he wants. Unless he is looking to break the loop at a specific point. If he wants the pattern to go on until a specific point the for loop would be useful but until he replies again I think you got what he wanted.
Report Abuse
Kondou is not online. Kondou
Joined: 05 Aug 2012
Total Posts: 1148
22 Dec 2012 03:10 PM
Great.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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