Its showing diffrent things on my leaderstat

You can write your topic however you want, but you need to answer these questions:
i wanna fix my leaderstat since its bugged

in the folder and gui it shows 1$ but on the leaderstats it shows 0.9
and i have no idea how to fix it

1 Like

NEVERMIND I didn’t see the whole picture your post includes

(pls lemme post)

If you change the number to 1 again, does it still remain at 0.9?

If i change it in the folder can press enter it changes to 1 in the leaderstat. But idk why its showing 0.9 in the start

1 Like

Hm that’s weird. I guess you could use math.round on the number everytime you detect that it’s a decimal (you can detect this by doing this:

if Money.Value == math.floor(Money.Value) then

)

the game does use decimals. at the start u gain 0.01 per click

Well that’s probably why. You’re not directly changing it to one.

Wait so I guess this is solved then?

thought it did that by it self

You might be changing it on the client side but then updating it on the server side

The leaderboard shows the values as they are on the server. When you change the value on the client, it does not replicate (in other words, actually change) on the server.

Let me know if you are changing the value of Money on the client-side, and I can further help you.

Sorry, went to bed. I have checked on the client and server and it both says 1. but displays 0.9

Try putting other values to see what’s happening.

I did find something
In this script if i remove the remaining money part. then when i play i can reach 1$.
but that part is necessary since sometimes the money u should recive is larger than the amount u have.


game.Players.PlayerAdded:Connect(function(player)
    local money = player:WaitForChild("leaderstats"):WaitForChild("Money")
    local PStats = player:WaitForChild("Stats")
    local PlayerBag = PStats:WaitForChild("PlayerBag")
    local PlayerPower = PStats:WaitForChild("PlayerPower")
    local RankMulti = PStats:WaitForChild("RankMulti")
    local TierMulti = PStats:WaitForChild("TierMulti")

    local debounce = false

    local function GetMoney()
        if not debounce then
            debounce = true
			local Multiplier = RankMulti.Value * TierMulti.Value
            local ToGive = (PlayerPower.Value / 100) * Multiplier
            if PlayerBag.Value == 0 then
                print("You don't have enough money in your bag to receive money.")
            elseif PlayerBag.Value < ToGive then
                local remainingMoney = PlayerBag.Value
                money.Value = money.Value + remainingMoney * Multiplier
                PlayerBag.Value = PlayerBag.Value - remainingMoney
                print("You don't have enough money in your bag to receive the full amount. Received remaining money: $" .. string.format("%.2f", remainingMoney))
            else
				money.Value = money.Value + ToGive
                PlayerBag.Value = PlayerBag.Value - ToGive
                print("Received money: $" .. string.format("%.2f", ToGive))
            end
            task.wait(0.05)
            debounce = false
        end
    end

    if Events.GetMoney then
        Events.GetMoney.OnServerEvent:Connect(GetMoney)
    end
end)```

If this probleme is yet solved, can you show us some pictures? The Money Value from the explorer for the player (for you), your script for changing the money in GUI

Try to replace this

local remainingMoney = PlayerBag.Value

With

local remainingMoney = PStats:WaitForChild("PlayerBag").Value

Or move the player bag into the function.

Could it be that you have used Stats and Money in different places?

Yeah sure


image


game.Players.PlayerAdded:Connect(function(player)
    local money = player:WaitForChild("leaderstats"):WaitForChild("Money")
    local PStats = player:WaitForChild("Stats")
    local PlayerBag = PStats:WaitForChild("PlayerBag")
    local PlayerPower = PStats:WaitForChild("PlayerPower")
    local RankMulti = PStats:WaitForChild("RankMulti")
    local TierMulti = PStats:WaitForChild("TierMulti")

    local debounce = false

    local function GetMoney()
        if not debounce then
            debounce = true
			local Multiplier = RankMulti.Value * TierMulti.Value
            local ToGive = (PlayerPower.Value / 100) * Multiplier
            if PlayerBag.Value == 0 then
                print("You don't have enough money in your bag to receive money.")
            elseif PlayerBag.Value < ToGive then
                local remainingMoney = PlayerBag.Value
                money.Value = money.Value + remainingMoney * Multiplier
                PlayerBag.Value = PlayerBag.Value - remainingMoney
                print("You don't have enough money in your bag to receive the full amount. Received remaining money: $" .. string.format("%.2f", remainingMoney))
            else
				money.Value = money.Value + ToGive
                PlayerBag.Value = PlayerBag.Value - ToGive
                print("Received money: $" .. string.format("%.2f", ToGive))
            end
            task.wait(0.05)
            debounce = false
        end
    end

    if Events.GetMoney then
        Events.GetMoney.OnServerEvent:Connect(GetMoney)
    end
end)

Yeah. It’s probably a bug in the place it happened to me before. Try doing it in a new place. Unless the value is also 1 in the server side on the explorer. Still also try to put other values from the server side and see how it works.

I have managed to solve the issue. The issue was that the remaining money was giving for example 0.009999999999999999999247 instead of 0.01

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.