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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: While true do [HELP]

Previous Thread :: Next Thread 
Turgon is not online. Turgon
Joined: 19 Sep 2010
Total Posts: 98
12 Aug 2013 03:48 AM
Hi, im trying to make a Rasengan script to improve my scripting. I made 3 spheres each one bigger than the other, and the top 2 ones have cloud decal which i want to make spin. I did make them spin using a "while true do" but the problem is IT STOPS THE ENTIRE SCRIPT. Seriously, when 'while' starts it completely ignores the rest of the script and only runs the 'while' part. I don't know what to do about this. I can move the arm before spinning the spheres, but i don't want it that way. Any fix for this? :/

Here's the part of the script:
..
..
..
----
while true do
w2.C0 = w2.C0 * CFrame.Angles(.1,.3,.2)
w3.C0 = w3.C0 * CFrame.Angles(.3,.1,.2)
wait()
end
----
wait(1.2) -- It doesn't work after here..
joint[2].C0 = joint[2].C0 * CFrame.Angles(0.9,0,1)
wait()
..
..
..
Report Abuse
Sinusoid is not online. Sinusoid
Joined: 01 Mar 2013
Total Posts: 1642
12 Aug 2013 03:49 AM
while true do
w2.C0 = w2.C0 * CFrame.Angles(.1,.3,.2)
w3.C0 = w3.C0 * CFrame.Angles(.3,.1,.2)
wait(1.2)
joint[2].C0 = joint[2].C0 * CFrame.Angles(0.9,0,1)
wait(1)
end
Report Abuse
Turgon is not online. Turgon
Joined: 19 Sep 2010
Total Posts: 98
12 Aug 2013 04:00 AM
But then the rest of the script won't work. And it will keep placing the arm in that position. :/
Report Abuse
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
12 Aug 2013 05:05 AM
A script waits until the loop ends.

Put the code in Spawn(function()

end)
Report Abuse
Turgon is not online. Turgon
Joined: 19 Sep 2010
Total Posts: 98
12 Aug 2013 06:38 AM
It didn't work.
Report Abuse
Turgon is not online. Turgon
Joined: 19 Sep 2010
Total Posts: 98
12 Aug 2013 06:58 AM
So, i added the spheres i created to Debris as a time limit. And the while loop will only work if 'rasm' is not nil. And then i added the arm moving script below it. After the spheres disappear, nothing happens..
Report Abuse
MainSpeaker is not online. MainSpeaker
Joined: 03 Aug 2013
Total Posts: 16
12 Aug 2013 07:11 AM
You could have made your resengan without a while loop, but if you must have it you need to know that they do stop the script unless you store them in a coroutine like this.


coroutine.resume(coroutine.create( function()
while true do
w2.C0 = w2.C0 * CFrame.Angles(.1,.3,.2)
w3.C0 = w3.C0 * CFrame.Angles(.3,.1,.2)
wait()
end
----
wait(1.2) -- It doesn't work after here..
joint[2].C0 = joint[2].C0 * CFrame.Angles(0.9,0,1)
wait()

end
end))


If this dosent work tell me the error.
Report Abuse
Infocus is not online. Infocus
Joined: 28 Apr 2011
Total Posts: 8022
12 Aug 2013 07:13 AM
Is the end with two ending parenthesis for the coroutine ^?


Because I only put 1 on mine and it works e-e?
Report Abuse
MainSpeaker is not online. MainSpeaker
Joined: 03 Aug 2013
Total Posts: 16
12 Aug 2013 07:15 AM
You have to put two or it errors @infocus, I have no idea how yours worked.
Report Abuse
Turgon is not online. Turgon
Joined: 19 Sep 2010
Total Posts: 98
12 Aug 2013 07:16 AM
It says " ')' expected (to close line '(' at line 150) near 'end' ", weird cause the end's are right .-.
Report Abuse
MainSpeaker is not online. MainSpeaker
Joined: 03 Aug 2013
Total Posts: 16
12 Aug 2013 07:21 AM
Did you do infocuses way or mine?
Report Abuse
Turgon is not online. Turgon
Joined: 19 Sep 2010
Total Posts: 98
12 Aug 2013 07:23 AM
Both.. o.e
Report Abuse
MainSpeaker is not online. MainSpeaker
Joined: 03 Aug 2013
Total Posts: 16
12 Aug 2013 07:26 AM
Then its somewere else in your code. Or your not iterating it in correctly.;
Report Abuse
Turgon is not online. Turgon
Joined: 19 Sep 2010
Total Posts: 98
12 Aug 2013 07:32 AM
I checked everything it should be right.

function onKeyDown(key)
local Debounce = false
if key == "r" and not Debounce then
--Other skill here
end
if key == "f" and not Debounce then
Debounce = true
--Other scripts here
----
coroutine.resume(coroutine.create( function()
while rasm do
w2.C0 = w2.C0 * CFrame.Angles(.1,.3,.2)
w3.C0 = w3.C0 * CFrame.Angles(.3,.1,.2)
wait()
end
----
joint[2].C0 = joint[2].C0 * CFrame.Angles(0,0,-1.6)
wait()
hum.WalkSpeed = 16
----
end
end))
end
end
Report Abuse
Infocus is not online. Infocus
Joined: 28 Apr 2011
Total Posts: 8022
12 Aug 2013 07:32 AM


while wait() do
w2.C0 = w2.C0 * CFrame.Angles(.1/.1*.1, .3/.3*.3, .2/.2*.2)
w3.C0 = w3.C0 * CFrame.Angles(.3/.3*.3, .1/.1*.1, .2/.2*.2)
end

joints[2].C0 = joints[2].C0 * CFrame.Angles(.9, 0, 1)

Report Abuse
ClassyCr3w is not online. ClassyCr3w
Joined: 10 Aug 2013
Total Posts: 22
12 Aug 2013 07:33 AM
Making a admin commands script currently.
Report Abuse
Infocus is not online. Infocus
Joined: 28 Apr 2011
Total Posts: 8022
12 Aug 2013 07:35 AM
Make sure joints[2] is define

joints = {game.Players.Character.Torso:findFirstChild("Right Shoulder")}


joints[1].C0 = joints[1].C0 * CFrame.Angles(X, Y, Z)

Report Abuse
Infocus is not online. Infocus
Joined: 28 Apr 2011
Total Posts: 8022
12 Aug 2013 07:38 AM
WAIT A SECOND

LOLOLOL IM SUCH A NOB


Of course it'll never read the following because it will keep running the while loop


So instead of while wait() do/while true do, put this instead

for i = 1, 12 do
--Code
wait(.03)
end
Report Abuse
Infocus is not online. Infocus
Joined: 28 Apr 2011
Total Posts: 8022
12 Aug 2013 07:39 AM
for i = 1, 15 do
wait(.03)
w2.C0 = w2.C0 * CFrame.Angles(.1/.1*.1, .3/.3*.3, .2/.2*.2)
w3.C0 = w3.C0 * CFrame.Angles(.3/.3*.3, .1/.1*.1, .2/.2*.2)
end

joints[2].C0 = joints[2].C0 * CFrame.Angles(.9, 0, 1)
Report Abuse
Turgon is not online. Turgon
Joined: 19 Sep 2010
Total Posts: 98
12 Aug 2013 07:41 AM
but i need it to spin until they get deleted by the Debris. And whats up with those angles? XD
Report Abuse
Turgon is not online. Turgon
Joined: 19 Sep 2010
Total Posts: 98
12 Aug 2013 07:42 AM
wait, i put that inside while true do? If so, nothing would change... .-.
Report Abuse
Infocus is not online. Infocus
Joined: 28 Apr 2011
Total Posts: 8022
12 Aug 2013 07:46 AM
coroutine.resume(coroutine.create(function()

while wait(.03) do
w2.C0 = w2.C0 * CFrame.Angles(.1/.1*.1, .3/.3*.3, .2/.2*.2)
w3.C0 = w3.C0 * CFrame.Angles(.3/.3*.3, .1/.1*.1, .2/.2*.2)
end

joints[2].C0 = joints[2].C0 * CFrame.Angles(.9, 0, 1)

end))
Report Abuse
Turgon is not online. Turgon
Joined: 19 Sep 2010
Total Posts: 98
12 Aug 2013 07:51 AM
I fixed it. I used the for script to rotate it and got the timing exactly right. So the for loop works as the countdown. It works great now! Thanks info :D
Report Abuse
Infocus is not online. Infocus
Joined: 28 Apr 2011
Total Posts: 8022
12 Aug 2013 07:54 AM
Ye im laik...why would u loop anims with while ._.


Remember, you heard it here first folks!

while true do end
Report Abuse
Turgon is not online. Turgon
Joined: 19 Sep 2010
Total Posts: 98
12 Aug 2013 08:00 AM
Another unrelated problem, how come Debouncing never works? I don't want the skill to be able to re-run when its already running. So im using a bool for it but it still happens...
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