How to make a gui disappear forever

Hey! I tried to make some kind of tutorial gui for new player in my game. The gui looks like this.
image

What I want is to make the gui disappear forever when player clicked both buttons. This means it will not show anymore even though player rejoin or reset. Any idea how to make this?

Yep! That’s really easy. Just put this script in both of them:

local Frame = --Path to the Frame which the buttons are in

script.Parent.Mouse1ButtonClick:Connect(function()
    Frame.Visible = false

Tell me if it works, and if it doesn’t I’ll look for any spelling mistakes

The script above will only make it so it disappears when the button is pressed. About the rest, idk if it works, but follow @msix29 's instructions. Have a good day!! :happy3:

1 Like

Make a bool value and when removing the ui set it to true and save the bool value, when joining If it’s true, destroy that ui

1 Like

Thanks for the help but that’s not exactly what I meant, I want so that gui is gone forever when player clicked it. Your script will just make the gui not visible for a single game/server. So when player rejoined, it will showed up again.

that seems good, I’ll try that. Also how to use datastore to save the bool value? can you give me references to that topic because I’m still confused about datastore?

Use Datastore2 as it’s more secure, there is plenty of tutorials online and the forum post has a tutorial itself.

If you didn’t understand or couldn’t use, tell me

Im not entirely sure how datastores work, but you could probably store a bool value that detects true or false if the player has already completed / closed the button, leaving as true = frame:destroy()

I cannot elaborate any more on this as i have not tested or used datastores, ever, im just making a suggestion from what ive heard about it.

you can great like a separate screengui from it and then destory the gui when they press either of the buttons after that turn ResetOnSpawn in the screengui off so that it doesn’t come up when they reset

1 Like

ok so I created a datastore script for that but I guess it does not saves the boolvalue.

Trigger (a localscript inside the gui to change the boolvalue's value)
local yes          = script.Parent.Yes
local no           = script.Parent.No
local TutorialMain = script.Parent.Parent
local bool     = game:GetService("Players").LocalPlayer:WaitForChild("Values"):WaitForChild("Tutorial")

no.MouseButton1Click:Connect(function()
	bool.Value = true
end)

yes.MouseButton1Click:Connect(function()
	bool.Value = true
	print("teleporting")
end)

bool.Changed:Connect(function()
	if bool.Value == true then
		TutorialMain:Destroy()
	end
end)
Datastore server script to save the bool's value
local tutorframe = script.Parent.Parent
local datastore  = game:GetService("DataStoreService")
local ds         = datastore:GetDataStore("datatest")

game.Players.PlayerAdded:Connect(function(plr)
	local values    = plr:WaitForChild("Values")
	local tutorbool = Instance.new("BoolValue", values)
	tutorbool.Name  = "Tutorial"
	
	local dataofuser = ds:GetAsync(plr.UserId)
	if dataofuser ~= nil then
		tutorbool.Value = ds[1]
	else
		tutorbool.Value = false
	end
end)

game.Players.PlayerRemoving:Connect(function(plr)
	local datasave = {}
	table.insert(datasave, plr:WaitForChild("Values"):WaitForChild("Tutorial").Value)
	local success,response = pcall(function()
		ds:GetAsync(plr.UserId,datasave)
	end)
	
	if success then
		print("Tutorial closed")
	else
		warn(response)
	end
end)

The local script (Trigger) works perfectly, it changes the bool’s value to true and destroys the gui, but the server script don’t save the bool’s value when I rejoined. Also there’s no errors too

why are you using default datastore, you should be using something like profileservice, and datastore2 shouldnt be used due to it being deprecated.
and #2 why is the value you’re saving a bool value? all you have to do is save a bool in a table, no need to save the value from an instance.

You must make the LocalScript contact with the ServerScript using a RemoteEvent. Have a function in the ServerScript listen to the RE’s OnClientEvent(plr, other stuff you want to send), and then FireServer() using the LocalScript.

A setup as simple as this should work:

Explorer:

ReplicatedFirst
  - OneTimeGUI <- a RemoteEvent
ServerScriptService
  - OneTimeGUIScript <- a ServerScript
-- Server Script
local One_Time_GUI = game:GetService("ReplicatedFirst").OneTimeGUI

-- ... your other DataStore stuff

One_Time_GUI.OnServerEvent:Connect(function(Player, _)
	-- ... your DataStore logic
end)
-- Local Script

local One_Time_GUI = game:GetService("ReplicatedFirst").OneTimeGUI

-- ... your GUI stuff

script.Parent.Mouse1ButtonClick:Connect(function()
	-- ... your other GUI logic, and then...
	One_Time_GUI:FireServer()
end

It is because of BindToClose not existing, some data loss might happen, I told you to use Datastore2, it’s way better and way more secure.

And you are changing the value on the client so no difference will happen anyways.