I want to make a one time only gui for a tutorial. I don’t want it to be visible every time, I want it to show once the GUI is closed or done.
The issue is that it keeps saying nil when finding it. I am using a Local script (I mean its kind of obvious), and I used datastores, editing values and stuff.
Here are the scripts:
Close GUI (Skip tutorial)
if game.Players.LocalPlayer.OneTimeGui.Value = true then
script.Parent.Visible = false
end
Finish GUI (When player is at the end of the tutorial)
local onetimegui = game.Players.LocalPlayer:WaitForChild("OneTimeGui")
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Parent.Parent.MainFrame.Visible = true
onetimegui.Value = true
end)
I have my datastores in one script. I don’t know if the datastore is broken but does not seem to being spitting any errors in console at the moment.
Use remote events to FireServer when the GUI is closed and then have the server script modify the datastore. You can also use remote functions to check if they have already viewed the gui.
Although this is a bit confusing (I guess I am between a bit advanced and a bit simple), I think I can try, I hope I can get this to work. I will try to post error messages if I have any issues.
Heres a quick example.
--Example
local DataStoreService = game:GetService("DataStoreService")
local guiStore = DataStoreService:GetDataStore("NameOfDatastore")
local checkFunction = game.ReplicatedStorage:WaitForChild("remoteFunctionName")
local finishedEvent = game.ReplicatedStorage:WaitForChild("remoteEventName")
checkFunction.OnServerInvoke = function(Player)
if --[[Datastore Value Is True]] then
return true
end
return false --They havent completed it
end
finishedEvent.OnServerEvent:Connect(function(Player)
--Set Datastore Value to true
end)