Rostrum
|
  |
| Joined: 03 Dec 2011 |
| Total Posts: 26824 |
|
|
| 11 Aug 2017 10:18 AM |
idk why i cant get this but someone fix this for me because i must have lost my brain cells
local debounce = false
if not debounce then script.Parent.ClickDetector.MouseClick:Connect(function(plr) game.ServerStorage.Key:Clone().Parent = plr.Backpack debounce = true end) end
|
|
|
| Report Abuse |
|
|
Rostrum
|
  |
| Joined: 03 Dec 2011 |
| Total Posts: 26824 |
|
|
| 11 Aug 2017 10:20 AM |
ah i just figured out why because it keeps iterating through the loop and making debounce false again
but i still dont know how to fix that
|
|
|
| Report Abuse |
|
|
|
| 11 Aug 2017 10:20 AM |
local debounce = false
script.Parent.ClickDetector.MouseClick:Connect(function(plr) if not debounce then debounce = true game.ServerStorage.Key:Clone().Parent = plr.Backpack debounce = false end end) |
|
|
| Report Abuse |
|
|
LeafDoode
|
  |
| Joined: 29 May 2017 |
| Total Posts: 3094 |
|
|
| 11 Aug 2017 10:20 AM |
| try adding the statement inside the event |
|
|
| Report Abuse |
|
|
|
| 11 Aug 2017 10:21 AM |
You define debounce to be false
then, when you say if not debounce then
I think that means "if true then" which it is not true. The way you should do it is write if debounce == false then.
Also, I suggest having the function on the outside then it checks if debounce == false AFTER you click.
im not a jerk but homie u 5 |
|
|
| Report Abuse |
|
|
LeafDoode
|
  |
| Joined: 29 May 2017 |
| Total Posts: 3094 |
|
| |
|
Rostrum
|
  |
| Joined: 03 Dec 2011 |
| Total Posts: 26824 |
|
|
| 11 Aug 2017 10:22 AM |
thanks but it still isnt working properly for some reason
can still give myself infinite tools if i spamclick it
|
|
|
| Report Abuse |
|
|
|
| 11 Aug 2017 10:22 AM |
| lowercase the 'c' in connect |
|
|
| Report Abuse |
|
|
|
| 11 Aug 2017 10:23 AM |
^
that's deprecated, don't do that |
|
|
| Report Abuse |
|
|
|
| 11 Aug 2017 10:24 AM |
db = false
script.Parent.ClickDetector.MouseClick:Connect(function(plr) if db == false then game.ServerStorage.Key:Clone().Parent = plr.Backpack db = true end end)
try this
im not a jerk but homie u 5 |
|
|
| Report Abuse |
|
|
caca50
|
  |
| Joined: 10 Jul 2011 |
| Total Posts: 2037 |
|
|
| 11 Aug 2017 10:26 AM |
If you want one tool, then don't set the debounce back to false.
Like actually think about what you're doing, you have it set to false, then if it's false, set it to true, do something that takes virtually no time, then set it right back to false.
Of course you can spam click it.
To have some wait time:
local db=false
function click() if not db then db=true --do something wait(someTime) db=false end end
For a one time thing:
local db=false function click() if not db then db=true --do something end end
Roblox.Forum.Scripters:1: bad argument #1 to 'intellect' (number expected, got nil) |
|
|
| Report Abuse |
|
|
Rostrum
|
  |
| Joined: 03 Dec 2011 |
| Total Posts: 26824 |
|
|
| 11 Aug 2017 10:27 AM |
| @malicious seemed to work, thank you # |
|
|
| Report Abuse |
|
|
|
| 11 Aug 2017 10:27 AM |
Also, I'm not a professional scripter or anything but for things which many players use, I tend to use boolvalues instead of db in a script. I find that it's more reliable for controlling the whole server instead of just one person. If my suggestion above still doesn't work, try adding a value in the player and change the value to true when they get the tool
im not a jerk but homie u 5 |
|
|
| Report Abuse |
|
|
|
| 11 Aug 2017 10:29 AM |
to minimize chances of spamming, you can put the db = true before giving the tool as well since the script reads line to line
im not a jerk but homie u 5 |
|
|
| Report Abuse |
|
|
Sulfone
|
  |
| Joined: 19 Aug 2010 |
| Total Posts: 8046 |
|
|
| 11 Aug 2017 10:31 AM |
@Maliciously_Intended The not operator gives a value of false when given true, and vice versa. not true -> false not false -> true not (variables or value that is true) -> false not (variables or value that is false) -> true
"if debounce == false" = "if not debounce" when it comes to bools. |
|
|
| Report Abuse |
|
|
|
| 11 Aug 2017 10:38 AM |
@Sulfone but if he said debounce = false then when you do not debounce doesn't that return true?
im not a jerk but homie u 5 |
|
|
| Report Abuse |
|
|
caca50
|
  |
| Joined: 10 Jul 2011 |
| Total Posts: 2037 |
|
|
| 11 Aug 2017 10:40 AM |
Because when you type:
'if variable then'
It's detecting if that variable is true.
when you type:
'if not variable then'
It's detecting if the opposite of the variable is true.
Simple concept.
Roblox.Forum.Scripters:1: bad argument #1 to 'intellect' (number expected, got nil) |
|
|
| Report Abuse |
|
|
|
| 11 Aug 2017 10:44 AM |
im an idiot. I forgot how if then works. I forgot it just fires if it returns true. sorry for typing such stupidness here.
im not a jerk but homie u 5 |
|
|
| Report Abuse |
|
|