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: repeat until

Previous Thread :: Next Thread 
masterblokz is not online. masterblokz
Joined: 17 Nov 2010
Total Posts: 9517
12 Dec 2014 12:45 AM
I'm trying to do

until RemoveS.MouseButton1Click:connect(function()

--
end)
not working..
Report Abuse
masterblokz is not online. masterblokz
Joined: 17 Nov 2010
Total Posts: 9517
12 Dec 2014 12:55 AM
plz
Report Abuse
LPGhatguy is not online. LPGhatguy
Forum Moderator
Joined: 27 Jun 2008
Total Posts: 4725
12 Dec 2014 01:02 AM
I believe what you're trying to do is

RemoveS.MouseButton1Click:wait()
-- do things here
Report Abuse
masterblokz is not online. masterblokz
Joined: 17 Nov 2010
Total Posts: 9517
12 Dec 2014 01:05 AM
That's close, but instead of repeating until the button is clicked, it repeats everytime it is clicked.
Report Abuse
masterblokz is not online. masterblokz
Joined: 17 Nov 2010
Total Posts: 9517
12 Dec 2014 01:14 AM
AHHHH
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
12 Dec 2014 01:52 AM
Are you trying to make it repeat something until the mouse is up?

Like click and hold?
Report Abuse
SLY3 is not online. SLY3
Joined: 10 Jul 2008
Total Posts: 1700
12 Dec 2014 09:29 AM
Do you mean until the event occurs? If so, then you don't need repeat wait(), you just do the function:

--
RemoveS.MouseButton1Click:connect(function()

end)
--

And it will wait until the MouseButton1Click event has occurred.
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
12 Dec 2014 01:55 PM
@Sly3
Actually, no
RemoveS.MouseButton1Click:wait()

Would wait until its fired
Report Abuse
masterblokz is not online. masterblokz
Joined: 17 Nov 2010
Total Posts: 9517
12 Dec 2014 03:51 PM
naw that's what the other guy said

i mean like

repeat
---

until mouse gets clicked
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
12 Dec 2014 03:52 PM
'RemoveS.MouseButton1Click:wait()'

What 128 said is correct if you are doing it correctly
Report Abuse
masterblokz is not online. masterblokz
Joined: 17 Nov 2010
Total Posts: 9517
12 Dec 2014 03:53 PM
i know but it doesn't match the method i am going for. I need something to keep repeating and immediately stop if the mouse is clicked
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
12 Dec 2014 03:59 PM
oh. there is probably a better way to do this

local x = true;
coroutine.wrap(function()
blah.MouseButton1Click:wait();
x = false;
end)();

while x do
--stuff
end
Report Abuse
masterblokz is not online. masterblokz
Joined: 17 Nov 2010
Total Posts: 9517
12 Dec 2014 03:59 PM
i might use that but is there a way to do it with repeat?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
12 Dec 2014 04:25 PM
repeat
--stuff
until not x
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
12 Dec 2014 04:57 PM
Avoiding coroutines like a moron:

local gotclickedWoop = false
local this = RemoveS.MouseButton1Click:connect(function()
gotclickedWoop =true;
this:disconnect()
this=nil;
end)
repeat something until gotclickedWoop
gotclickedwoop=nil
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
12 Dec 2014 04:58 PM
Nah, disconnect is for losers :)
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
12 Dec 2014 04:59 PM
That's me then
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
12 Dec 2014 05:02 PM
nag
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
12 Dec 2014 11:42 PM
local this = RemoveS.MouseButton1Click:connect(function()
gotclickedWoop =true;
this:disconnect()
this=nil;
end)


That wouldn't work


local this;
this = RemoveS.MouseButton1Click:connect(function()
gotclickedWoop =true;
this:disconnect()
this=nil;
end)
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
13 Dec 2014 08:13 AM
I think it would work, because by the time the connection has returned it is still allowed access to the scope it was made in because of closures.
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
13 Dec 2014 11:38 AM
You would think it would, and it definitely should, but it doesn't
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
13 Dec 2014 11:43 AM
Example


local object = Instance.new("Model")
local self = object.Changed:connect(function()
self:disconnect()
end)
wait(3)
object.Name = "model" -->local self = object.Ch:3: attempt to index global 'self' (a nil value)


But if you swap it to
local self;
self = blah
You get no error

This isn't a logical type thing, I only know it because I've done it before
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
13 Dec 2014 03:21 PM
It doesn't work because the variable is declared AFTER 'self:disconnect()' meaning nil:disconnect() meaning AHH!!1
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
13 Dec 2014 03:34 PM
.-.
Fine it would work if self was not local
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