I think I typed this right. But i keep getting a annoying error in the output. "leaderstats is not a valid member of player" even though it is a valid member of player.
local playerstats = game.Players.LocalPlayer.leaderstats.Coins local playerstats2 = game.Players.LocalPlayer.leaderstats.Clicks local aneeded = 1000 function exchange() if playerstats2.Value >= aneeded then playerstats2.Value = playerstats2.Value - aneeded and playerstats.Value == playerstats.Value + 1 end end script.Parent.MouseButton1Click:Connect(exchange)
That sometimes happen because the script is replicated some miliseconds before the leaderstats and then it does not find it, the way you can fix it is using :WaitForChild()
local playerstats = game.Players.LocalPlayer:WaitForChild("leaderstats").Coins
does not need to do that for the second variable since it will only execute the rest when leaderstats was detected.