Hello, I Really Need Help In This And I'm A Beginner Is Coding So Could You Please Help Me With This Script??
01 | local db = false |
02 | local tool = script.Parent |
03 | repeat wait() until tool.Parent.Parent:IsA( "Player" ) |
04 | local plr = tool.Parent.Parent |
05 | local character = plr.Character |
06 |
07 | tool.Activated:Connect( function () |
08 | if not db then |
09 | plr.leaderstats.Power.Value = plr.leaderstats.Power.Value + 1 |
10 | db = false |
11 | end |
12 | end ) |
Your debounce isn't set up correctly. You set debounce to false even though it is already false and you have no cooldown.
01 | local db = false |
02 | local tool = script.Parent |
03 | repeat wait() until tool.Parent.Parent:IsA( "Player" ) |
04 | local plr = tool.Parent.Parent |
05 | local character = plr.Character |
06 |
07 | tool.Activated:Connect( function () |
08 | if not db then |
09 | db = true |
10 | plr.leaderstats.Power.Value = plr.leaderstats.Power.Value + 1 |
11 | wait( 1 ) -- this is the cooldown, edit 1 to whatever number to make it longer or shorter |
12 | db = false |
13 | end |
14 | end ) |
You can use roblox's sample on debounce if you need more help with it: https://developer.roblox.com/en-us/articles/Debounce
Marked as Duplicate by User#6546
This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.
Why was this question closed?