I have a leaderstats money currency script, but it is fine, working. Now I wish to increase the value of the currency for a player by clicking on an object with ClickDetector. I'm struggling with it, help please ?
local Loot = script.Parent local Player = game.Players.LocalPlayer local Cash = Player.leaderstats.IntValue local Stats = Player.leaderstats Cash.Parent = Stats Stats.Parent = Player function OnClicked() Cash.Value = Cash.Value+10 end Loot.ClickDetector.MouseClick:connect(OnClicked)
Loot.ClickDetector.MouseClick:Connect(function(playerWhoclicked) if playerWhoclicked then playerWhoclicked.leaderstats.IntValue.Value = playerWhoclicked.leaderstats.IntValue.Value + 10 end end)