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
 

GUI Button Script Stops Working After Rapid Click

Previous Thread :: Next Thread 
vikingboy is not online. vikingboy
Joined: 25 Apr 2008
Total Posts: 1219
11 Jun 2014 09:04 PM
Hi, I'm trying to make a game somewhat like Cookie Clicker.
You see, when I spam click the button that adds points, it works to an extent, then it stops functioning (the script shuts down).

The script is still disabled = false though.

Any thoughts ideas?
Input would be helpful.

Cheers,
Report Abuse
vikingboy is not online. vikingboy
Joined: 25 Apr 2008
Total Posts: 1219
11 Jun 2014 09:12 PM
Bump.
Report Abuse
Brickman2010 is not online. Brickman2010
Joined: 20 Nov 2009
Total Posts: 5547
11 Jun 2014 09:15 PM
you can pcall the functions if you plan on going that fast. Or you can use a slight debounce. I can't tell because there is no script posted...
Report Abuse
vikingboy is not online. vikingboy
Joined: 25 Apr 2008
Total Posts: 1219
11 Jun 2014 09:29 PM
Here, can you help me out?

function Click(mouse)
script.Parent:TweenPosition(UDim2.new(script.Parent.Position.X.Scale, 0, -2, 0),"Out","Quad",.5)
script.Parent.Size = (UDim2.new(0.15,0,1,0))
wait(.5)
script.Parent.Visible = false
script.Parent.Parent.Parent.cash.Value = cash + swipeval*50
end

script.Parent.MouseButton1Down:connect(Click)


--> I have no idea what the pcall function you are talking about, may you use it in a example? Thank you so much!
Report Abuse
vikingboy is not online. vikingboy
Joined: 25 Apr 2008
Total Posts: 1219
11 Jun 2014 09:46 PM
Bump: can anyone help?
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
11 Jun 2014 10:02 PM
Add debounce may fix
Report Abuse
vikingboy is not online. vikingboy
Joined: 25 Apr 2008
Total Posts: 1219
11 Jun 2014 10:03 PM
@Legendary

How can I do that?

I'm sorry, I'm just a beginner!

Thank you so much for your help!
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
11 Jun 2014 10:05 PM
Heres debounce added

Local debounce = false

function Click(mouse)
if not debounce then

script.Parent:TweenPosition(UDim2.new(script.Parent.Position.X.Scale, 0, -2, 0),"Out","Quad",.5)
script.Parent.Size = (UDim2.new(0.15,0,1,0))
wait(.5)
script.Parent.Visible = false
script.Parent.Parent.Parent.cash.Value = cash + swipeval*50

buttonPressed = false
end
end

script.Parent.MouseButton1Down:connect(Click)
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
11 Jun 2014 10:09 PM
also heres a wiki for debounce

http://wiki.roblox.com/index.php?title=Debounce

All you need is


local debonce = true
-------varibles------------

--function
if not debounce then

--your code you dont want to be run multiple times over itself

debonce = false
end
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
11 Jun 2014 10:13 PM
Much typos

"dobonce" was ment to be debounce >.<
Report Abuse
vikingboy is not online. vikingboy
Joined: 25 Apr 2008
Total Posts: 1219
11 Jun 2014 10:26 PM
Still not working - it seems to be worse now..

any advice?
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
11 Jun 2014 10:30 PM
Nope im not sure now
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