i have a tool and i am trying to add +1 money every time i click with tool how do i make that happen
local money = game.Players.LocalPlayer.LeaderBoard.Money.Value local tool = game.StarterPack.Tool
It's because the StarterPack is only the folder where tools will be given to the player when they join the game or respawn.
Possible fix: Insert a normal script into the tool. Type in this code:
local tool = script.Parent -- Defining the tool. cooldown = false -- Making the cooldown variable tool.Activated:Connect(function() -- When the tool is activated if cooldown == false then -- Detects if the "cooldown" variable is equal to false game.Players[tool.Parent.Name].leaderstats.Money.Value = game.Players[tool.Parent.Name].leaderstats.Money.Value +1 -- Gives the player the cash. replace "Money" with the name of your currency cooldown = true -- Sets the "cooldown" variable to true script.Disabled = true -- makes it so the tool will no longer give the player money wait(1) -- Wait one second. Change to the cooldown time of the tool script.Disabled = false -- makes it to the tool will start giving the player money end -- Ends the "if" statement. end) -- Ends the function.
If you still need help, reply to this answer. Thanks!