Hi I am working on a tycoon and am trying to create a GUI that pops up for the user when they try to buy something with insufficient funds. The GUI will pop up the first time someone tries to buy something without enough money, but it does not pop up again. Could anyone help me troubleshoot this?
Here is my server side script:
function InsufficientFunds()
local Insuff = Instance.new("RemoteEvent")
Insuff.Parent = game.ReplicatedStorage
Insuff.Name = "Insuff"
Insuff:FireClient()
end
---- Some stuff here if he has enough money---- This part works
else
Sound(v, Settings.Sounds.ErrorBuy)
InsufficientFunds() --Calls my insufficientFunds function
client side:
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local player = Players.LocalPlayer
local Insuff = ReplicatedStorage:WaitForChild("Insuff")
local playerGui = player:WaitForChild("PlayerGui")
local shop = player.PlayerGui.Nope.Shop
local function InsufficientFunds()
shop.Visible = true
wait(5)
shop.Visible = false
end
Insuff.OnClientEvent:Connect(InsufficientFunds())

1 comment
My GUI is also popping up for everyone in the game. What could be going on here?