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: How to prevent spam clicking of the button?

Previous Thread :: Next Thread 
w8lq is not online. w8lq
Joined: 06 Jun 2017
Total Posts: 355
28 Jul 2017 08:52 AM
amount = 5
timedelay = 1
currencyname = "Cash"

script.Parent.mouseClick:connect(function()
script.Parent.Parent.Parent.Target.Transparency = 0.5
while true do
wait()
for i,v in pairs(game.Players:GetPlayers()) do
if v:FindFirstChild("leaderstats") and v then
v.leaderstats[currencyname].Value = v.leaderstats[currencyname].Value + amount
wait(2)
script.Parent.Parent.Parent.Target.Transparency = 0
end
end
end
end)

This is a button that gives the player money however i would like to add something like a 1 second pause inbetween to prevent spamming.
Report Abuse
Camper0008 is not online. Camper0008
Joined: 07 Apr 2013
Total Posts: 2504
28 Jul 2017 08:54 AM
amount = 5
timedelay = 1
currencyname = "Cash"
debounce = true
script.Parent.mouseClick:connect(function()
if debounce == true then
debounce = false
script.Parent.Parent.Parent.Target.Transparency = 0.5
while true do
wait()
for i,v in pairs(game.Players:GetPlayers()) do
if v:FindFirstChild("leaderstats") and v then
v.leaderstats[currencyname].Value = v.leaderstats[currencyname].Value + amount
wait(2)
script.Parent.Parent.Parent.Target.Transparency = 0
wait(timedelay)
debounce = true
end
end
end
end)


▪ I seem to get mentioned alot in videogames.. i wonder why..
Report Abuse
RubyEpicFox is not online. RubyEpicFox
Joined: 02 May 2015
Total Posts: 1828
28 Jul 2017 08:57 AM
debouncing.



bool = true

function dostuff()

if bool == true then

bool = false

--stuff.

bool = true

end

end

there you go.
Report Abuse
w8lq is not online. w8lq
Joined: 06 Jun 2017
Total Posts: 355
28 Jul 2017 08:58 AM
Workspace.Model.Target.ClickDetector.Script:21: unexpected symbol near ')'
Report Abuse
w8lq is not online. w8lq
Joined: 06 Jun 2017
Total Posts: 355
28 Jul 2017 09:02 AM
Do I put;
bool = true

end

end

after the other ends or before (the ones in the original script)
Report Abuse
w8lq is not online. w8lq
Joined: 06 Jun 2017
Total Posts: 355
28 Jul 2017 09:04 AM
b1
Report Abuse
Camper0008 is not online. Camper0008
Joined: 07 Apr 2013
Total Posts: 2504
28 Jul 2017 09:07 AM
amount = 5
timedelay = 1
currencyname = "Cash"
debounce = true
script.Parent.MouseClick:connect(function()
if debounce == true then
debounce = false
script.Parent.Parent.Parent.Target.Transparency = 0.5
wait()
for i,v in pairs(game.Players:GetPlayers()) do
if v:FindFirstChild("leaderstats") and v then
v.leaderstats[currencyname].Value = v.leaderstats[currencyname].Value + amount
end
end
wait(timedelay)
script.Parent.Parent.Parent.Target.Transparency = 0
debounce = true
end
end)

^^ this should work


▪ I seem to get mentioned alot in videogames.. i wonder why..
Report Abuse
w8lq is not online. w8lq
Joined: 06 Jun 2017
Total Posts: 355
28 Jul 2017 09:15 AM
thanks!
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