Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago

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?

0
It was a bit hard to understand what your trying to say. If you add me on disc I can take a look. Skydoeskey 108 — 4y
0
daniel99oslo#3852 Skydoeskey 108 — 4y
0
You should use database stuff and Visible bools, they might be the key. speedyfox66 237 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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

0
oops i typed on server inoke let me fix this megamanyoutuber 25 — 4y
Ad

Answer this question