Im running into the issue that on those clicks it removes 0.02 from the bag.
It only happens on those 2.
i have no idea why
– The script that fires the event
local Events = game.ReplicatedStorage.Events
script.Parent.Parent.MainFrame.GetMoneyButton.Activated:Connect(function()
Events.GetMoney:FireServer()
end)```
-- The script that gives the money
```local Events = game.ReplicatedStorage.Events
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 ToGive = (((PlayerPower.Value / 100) * RankMulti.Value) * TierMulti.Value)
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
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
PlayerBag.Value = PlayerBag.Value - ToGive
money.Value = money.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)