Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Blocking Off the Continue Button Until You've Pressed New Game?

I'm creating an adventure game where it starts off with a title screen, than the actual adventure game is an entirely different place. When you press the Continue button it brings you to the place, but when you press the New Game button, it brings you to a cutscene than when the cutscene is done it brings you to the main game. I need to know how to block off the Continue button unless you've pressed the New Game button, then if you press the Restart button it will block off the Continue button and you will have to press the New Game. I know this is not a request site but I need this if I need to finish my game. Do any of you know how this is done?

3 comments

0

It was a bit hard to understand what your trying to say. If you add me on disc I can take a look.

0

daniel99oslo#3852

0

You should use database stuff and Visible bools, they might be the key.

1 answer

For this you need data store. Which is a server part. I will show this SCRIPTS NEEDED: ServerScript (A.k.a Script) for RemoteEvent and RemoteFunction LocalScript RemoteEvent (To save) RemoteFunction (To load)

The part below will work if you have remote event and remote function

ServerScript:

dataStore = game:GetService("DataStoreService")
continueStore = dataStore:GetDataStore("ContinueStore")

RemoteEvent.OnServerEvent(function(player, dataType)
	if dataType == "Continue" then
		continueStore:SetAsync(player.userId .. "-continue", 1)
	end
end

RemoteFunction.OnServerInvoke = function(player,dataType)
	if dataType == "Continue" then
		value = continueStore:GetAsync(player.userId .. "-continue, 1)
		return value
	end
end

After we done through the server script. Well, we need to do local script Don't forget to disable the continue button.

LocalScript:

repeat wait until game.Players.LocalPlayer.Character -- Making this so it won't try to get information too quick
Function = RemoteFunction:InvokeServer(player,"Continue")

if Function == 1 then
	Continue.Visible = true
	Continue.LocalScript.Disabled = false
end

Now we need to fire the save thing, so yeah time to use the button localscript

Button LocalScript:

Button.MouseButton1Down:Connect(function()
	RemoteEvent:FireServer("Continue")
	-- Now your code
end

I think this will work

1 comment

0

oops i typed on server inoke let me fix this

This discussion is preserved as it was. New answers, comments, and votes are closed.