Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How Do I add an cooldown in this tool??? (help please) [closed]

Asked by 5 years ago

Hello, I Really Need Help In This And I'm A Beginner Is Coding So Could You Please Help Me With This Script??

1local tool = script.Parent
2local player = script.Parent.Parent.Parent
3 
4    tool.Activated:Connect(function()
5        player.leaderstats.Technology.Value = player.leaderstats.Technology.Value + 1
6end)

Closed as Not Constructive by User#6546

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

2 answers

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

There is something called debounce.

01local tool = script.Parent
02local player = script.Parent.Parent.Parent
03local debounce = false
04    tool.Activated:Connect(function()
05       if debounce then
06        debounce = true
07        player.leaderstats.Technology.Value = player.leaderstats.Technology.Value + 1
08        end
09        wait(2.5)
10        debounce = false
11end)
0
It Doesn't Work... Derrick_Dage -128 — 5y
0
Try again, it should work. I fixed it SilentsReplacement 468 — 5y
0
It Still Doesn't Work Derrick_Dage -128 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

My Leaderstats is

01function createLeaderstats(plr)
02    local leaderstats = Instance.new("StringValue")
03    leaderstats.Name = "leaderstats"
04    leaderstats.Parent = plr
05 
06    local technology = Instance.new("IntValue")
07    technology.Parent = leaderstats
08    technology.Name = "Technology"
09    technology.Value = 0
10 
11    local coins = Instance.new("IntValue")
12    coins.Parent = leaderstats
13    coins.Name = "Coins"
14    coins.Value = 0
15 
View all 24 lines...
0
Please check the script again, and tell me what EXACTLY do you want SilentsReplacement 468 — 5y
0
It Doesn't Give Me The Stats Derrick_Dage -128 — 5y