So, I am trying to make it so when you click on a part, you must wait a number which is an intvalue which is a child of boolvalue which is a child of a player in order to click it again. When you click another part, that value is supposed to go down, so can click faster. This is the script that I used in the part that you click again and again.
game.Players.PlayerAdded:Connect(function(plr)
local buttonbutton = 5
local buttonLvlTrack = Instance.new("BoolValue", plr)
buttonLvlTrack.Name = "ButtonLvl"
buttonLvlTrack.Value = buttonbutton
local buttonlvl = Instance.new("IntValue",buttonLvlTrack)
buttonlvl.Name = "level"
buttonlvl.Value = buttonbutton
end)
And this is the script that I used in the thing that's supposed to reduce the time you are supposed to wait.
local buy = script.Parent
local clickDetector = script.Parent:WaitForChild("ClickDetector")
clickDetector.MouseClick:Connect(function(plr)
local bt = plr:WaitForChild("ButtonLvl"):FindFirstChild("level").Value
bt = bt - 1
end)
There are no errors, warnings, or anything, but still won't work. Please help ^^

1 comment
In the last snippet you are using values and not references.