Hi so I was making my game and came across something which really bugged me, so in my game you have a value which is called "Cash" and you can buy stuff with it, but if you don't have enough it does absolutely nothing. I know many games use this cool error animations for example Theme Park Tycoon being one of them.
So I basically want a error message gui bar that appears at the top and when a player keeps clicking the error it scrolls down the other error you can see a good example of it in theme park tycoon. I already know how to use TweenPosition and I also know how to create a gui but I don't know how this would work. Please help.
I have already made the error animation when a player pressed the button and hasn't got enough money but everytime they press it again it just overlaps.
My code is here:
local button = script.Parent
local requiredCash = 1500 -- How much is required to buy it
local plr = game.Players.LocalPlayer
local leaderstats = plr:FindFirstChild("leaderstats")
local cash = leaderstats:FindFirstChild("Cash")
button.MouseButton1Click:connect(function()
if cash.Value >= requiredCash then
-- this just gives the player the stuff they need
else
local gui = Instance.new("ScreenGui", plr:FindFirstChild("PlayerGui"))
gui.Name = "ErrorBar"
local error = Instance.new("TextLabel", gui)
error.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
error.Text = "Error | You have insufficient funds"
error.Size = UDim2.new(1, 0, 0, 50)
error.TextWrapped = true
wait(4) -- delay
for i=0, 1, 0.1 do
wait()
error.BackgroundTransparency = i
end
gui:Remove()
end
end)
It creates a nice error but it has no animations and every time someone spam clicks it, it just overlaps and looks ugly.

3 comments
I understand how this would work, but what I mean is that when you spam the button if you still get the error, they scroll down and eventually disappear
What do you mean?
For example on Theme Park Tycoon when you get an error it appears on the top of your screen, but if you keep getting the same error instead of overlapping each other it moves above or below it