Hello! How can I make this so it shows the GUI for when you collect Coins, no matter what if you collect that stat. How can I do that? My current one for some reason, only shows it if you get a higher value then you had. Lets say you had 100 Coins, you sell them, then collect a Coin, it would not show up, but if you got back to 100, then got to 101 Coins then itβll show up, etc, etc. How can I fix this?
Example Video:
My current script:
local suffixes = {'','K','M','B','T','qd','Qn','sx','Sp','O','N','de','Ud','DD','tdD','qdD','QnD','sxD','SpD','OcD','NvD','Vgn','UVg','DVg','TVg','qtV','QnV','SeV','SPG','OVG','NVG','TGN','UTG','DTG','tsTG','qtTG','QnTG','ssTG','SpTG','OcTG','NoAG','UnAG','DuAG','TeAG','QdAG','QnAG','SxAG','SpAG','OcAG','NvAG','CT'}
local function format(val)
for i=1, #suffixes do
if tonumber(val) < 10^(i*3) then
return math.floor(val/((10^((i-1)*3))/100))/(100)..suffixes[i]
end
end
end
local Player = game.Players.LocalPlayer
script.Parent.Visible = true
local Stats = Player:WaitForChild("leaderstats")
local Cash = Stats:WaitForChild ("Coins")
repeat
wait(0.01)
script.Parent.Text = (format(Cash.Value)),"Out","Linear"
until script.Disabled == true
If that is not it, here is the script for the +Coins GUI Which is the script that makes it show up
local Players = game:GetService("Players")
local plr = script.Parent.Parent.Parent
local leaderstats = plr:WaitForChild("leaderstats")
local cash = leaderstats:WaitForChild("Coins")
local dif = 0
delay(.25, function()
dif = cash.Value
end)
cash.Changed:Connect(function()
if dif ~= cash.Value and dif <= cash.Value then
local random = math.random(1, 900)
local xnew = random / 1000
local new = script:WaitForChild("Coins"):Clone()
new:WaitForChild("CoinsInfo").Text = "+".. cash.Value - dif
new.Position = UDim2.new(xnew, 0, 1, 0)
new.Parent = script.Parent
dif = cash.Value
wait(0.1)
new:TweenPosition(UDim2.new(new.Position.X, 0, -0.1, 0))
wait(2)
new.Parent = nil
end
end)
Any help will be appreciated!