local Players = game:GetService("Players")
local function leaderbaordFunction(player) local leaderstats = Instance.new("Folder") leaderstats.Name = "leaderstats" leaderstats.Parent = player
local Strength = Instance.new("IntValue") Strength.Name = "Strength" Strength.Parent = leaderstats Strength.Value = 0 local Cash = Instance.new("IntValue") Cash.Parent = leaderstats Cash.Name = "Cash" Cash.Value = 0
end
Players.PlayerAdded:Connect(leaderbaordFunction)
local r = game.ReplicatedStorage.Click
r.OnServerEvent:Connect(function(player) player.leaderstats.Strength.Value = player.leaderstats.Strength.Value + 1 end)
Generally we use debounces to stop code from running excessively after being triggered.
It looks a little like this:
local debounce = false button.MouseButton1Click:Connect(function() if debounce == true then return end debounce = true -- do something wait(5) -- cooldown time debounce = false end)
Try modifying your code to fit something like this in there.
search youtube for Roblox studio debounce tutorial its really ez