Why is my script not running more than once after the button being pressed?

I made a button that runs a script stored in ServerScriptService with Remote Event. Within that script, has at least 2 functions. A function were called within another function. When I pressed the button once, it works as intended, but after pressing multiple times, it decide to not do anything at all or do only some of the task that was intended. I have about 3 leader stats updating every 1 to 10 sec to test the updates (not sure if this was the cause of the problems or not).
Edited: Leaderstats was not the cause of the problem, I’ve tested it.

Example of the script:
Here works fine, I love including this code because I tried to avoid players making new alt account.

	if player.AccountAge > MinimumAge then
		local gui = player.PlayerGui.ShopGui
		print("all good")
		print("possible alt account")

Specifically within this function, it only worked once after the button were pressed. if the player doesn’t have enough money, it doesn’t display the box that I made. Even if the player have enough money, it only reduced players money but didn’t show the successful box display and totally ignored my DisplayDetails function within this function… Any idea why?

function shoptime(player,gui)
	local money = player.moneystats.money.Value
	local group
	if money >= 100 then
		gui.Screen.Message.Visible = false
		local moneyBefore = point
		money = money - 100
		local moneyNow = money
		player.moneystats.Points.Value = moneyNow
		gui.Screen.Message.Visible = true
		gui.Screen.Message.Word.Text = "Successful! "
		gui.Screen.Message.Word.TextColor3 = Color3.new(0.0392157, 1, 0.101961)
		gui.Screen.Message.Visible = true
		gui.Screen.Message.Word.Text = "Not Enough! "
		gui.Screen.Message.Word.TextColor3 = Color3.new(1, 0, 0.0156863)

This is the localscript within the Message GUI to close it. i wonder if its the cause of the problem for not popping out the message GUI:

function onClick()
	local Close = script.Parent
	if (Close.Parent.Visible)then
		Close.Parent.Visible = false
1 Like

Seems like there’s a return in the DisplayDetails function.

If the code does not run the gui changes, then the problem is most likely within DisplayDetails.
Can you show me your code for DisplayDetails?