I'm trying to do a cash per second leaderstats for my new bedwars game in roblox, but whenever I modify the cash, it goes back to it's orginal state. If you didn't get that, here's what I mean.
game.Players.PlayerAdded:Connect(function(player)
wait(5)
while true do
player.coinsfolder.Coins.Value = player.coinsfolder.Coins.Value + 3
wait(3)
end
end)
This is the cash per second code.
script.Parent.MouseButton1Click:connect(function()
local price = 3
local player = game.Players.LocalPlayer
local stats = player:WaitForChild("coinsfolder")
if stats.Coins.Value >= price then
stats.Coins.Value = stats.Coins.Value - price
player.blocksfolder.blocks.Value = player.blocksfolder.blocks.Value + 1
end
end)
because it's a bedwars game, I need a shop. This is when you buy an amount of blocks from the store.
let's say that I have this many coins: https://gyazo.com/8613a8f0b953cbd0389fb643dbae4066
I buy the blocks, so I have this many coins now: https://gyazo.com/972ee6f1f7c1fb19d425f5fbc425beac
Then, it should be 16 coins, right? because 13 plus 3 is 16? the cash per minute adds 3 to my coins.
Instead, the cash per minute script instead ignores that the shop takes away 3, and it still thinks I have 16 coins instead of 13 that I have. So it jumps from 13 all the way to 19 instead. https://gyazo.com/2ea5acd141b295d1d82a1c7399022501 I think the problem is in the coins per second script. It will be a great help if you give me a hand. Thanks!

3 comments
format pls
please format it correctly
lol is that better