I just know the very basics of Lua since I didnt studied much this language. And what I was trying to do is to make a gui pop up in your screen only the first time you join the game. Dying or rejoining the game wouldnt trigger the gui to pop-up. It seems like the code reset when I die or I leave the game
I know my code sucks please dont judge
local no2x = 0 -- Variable to not allow the gui pop-up again
local Frame = script.Parent.Welcome -- The gui
local Button = script.Parent.Button -- The close button
if no2x == 0 then -- Code to execute if "no2x" is 0
Frame.Visible = true
Button.Visible = true
else if no2x == 1 then -- Code if "no2x" isnt 0
Frame.Visible = false
Button.Visible = false
if no2x == 1 then -- Output to see if the code is working
print("no2x set to 1")
Button.MouseButton1Click:Connect(function()
no2x = 1 -- Set "no2x" to 1 when the button is clicked
end)
end
end
end
I added the commentaries while writing this to make it easier to understand the code. Anyways if you know the fix for this crappy code I would thank you so much! Thanks for reading.

3 comments
The ScreenGui has a 'ResetOnSpawn' property which you can turn off.
Learn how to use DataStore so it doesn't trigger on rejoining.
ok thanks, im not focusing on data store rn but I will study it later