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: Rotating Brick

Previous Thread :: Next Thread 
hansotto is not online. hansotto
Joined: 21 Apr 2010
Total Posts: 233
21 Sep 2013 03:31 PM
I'm trying to make a script that makes its parent spin
Why does this not work?


i = 0
while true do
script.Parent.CFrame = script.Parent.CFrame * CFrame.Angles(i,0,0)
wait()
end
i = i + 1
Report Abuse
blackboy167thst is not online. blackboy167thst
Joined: 22 Jul 2011
Total Posts: 2468
21 Sep 2013 03:33 PM
Because you're adding the +1 after the while true do, which it will never get to it because it's looping forever. So I suggest you move the 'i = i + 1' into the while loop.

i = 0
while true do
script.Parent.CFrame = script.Parent.CFrame * CFrame.Angles(i,0,0)
i = i + 1
wait(0.2) -- wait() is too fast.
end

~rekt get
Report Abuse
hansotto is not online. hansotto
Joined: 21 Apr 2010
Total Posts: 233
21 Sep 2013 03:34 PM
Damn i'm dumb... :I

Thank you
Report Abuse
hansotto is not online. hansotto
Joined: 21 Apr 2010
Total Posts: 233
21 Sep 2013 03:37 PM
It spins now but, it keeps gaining more speed and then it stops and starts over and gains speed and over and over :P



i = 0
while 1 + 1 == 2 do
script.Parent.CFrame = script.Parent.CFrame * CFrame.Angles(i,0,0)
wait(0.2)
i = i + 0.05
end
Report Abuse
blackboy167thst is not online. blackboy167thst
Joined: 22 Jul 2011
Total Posts: 2468
21 Sep 2013 03:40 PM
Well, you are multiplying by i, which means if i = 1000, it will shift to 1000. Thus, looking like it teleports. Try this:

while wait() do
for i = 1, 360, 1 do
script.Parent.CFrame = script.Parent.CFrame * CFrame.Angles(i, 0, 0)
wait()
end
end

~rekt get
Report Abuse
Apatheia is not online. Apatheia
Joined: 16 Aug 2013
Total Posts: 198
21 Sep 2013 03:41 PM
That's because i is increasing, so the amount rotated increases too.

while wait(0.2) do
script.Parent.CFrame = script.Parent.CFrame * CFrame.Angles(0.05,0,0)
end
Report Abuse
hansotto is not online. hansotto
Joined: 21 Apr 2010
Total Posts: 233
21 Sep 2013 03:42 PM
Still looks weird... :/
Report Abuse
Apatheia is not online. Apatheia
Joined: 16 Aug 2013
Total Posts: 198
21 Sep 2013 03:42 PM
@black

No, it's not multiplying; the * operator in CFrames just add both together.
Report Abuse
hansotto is not online. hansotto
Joined: 21 Apr 2010
Total Posts: 233
21 Sep 2013 03:42 PM
Ur my hero! :3

Thx ^^
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