Cool prompt - Quick way to create in game prompts

Hello hello, my fellow devs!

“Cool prompt” is a module created to help beginners or just people in general who can’t bother creating their own prompt systems create in-game prompts in seconds!

You can get the module here: https://create.roblox.com/marketplace/asset/15763823189

To create a new prompt simply call the “.new” method.

local PromptClass = require(game.ReplicatedStorage.Prompt)


local MyPrompt = PromptClass.new()

Now you’ve created your prompt. When a prompt is created it’s activated instantly by default.

(Currently, there is no way to disable this behavior. So if you want to disable it you can either modify the code yourself. Or wait until I implement an option for it)

The default prompt looks like this in game. However, if you’d like to change it it’s really easy.


Simply replace the screengui called “Prompt” inside the module to your desired one.
Capture

!! NOTE !!
A custom gui has certain conditions that need to be met before it can be used. I’ve listed the optional things you need to consider when replacing the default gui.


  1. Gui must have its “ResetOnSpawn” property disabled. Having this enabled can cause some unexpected behaviors.

  2. Gui must have a frame called “Base”

  3. Base frame must have two buttons called “Button1” and “Button2”.

  4. Base frame must have two text labels called “Title” and “Text”.

If any of these conditions aren’t met the prompt will throw an error telling you what’s wrong.
image

There’s also a method to change the prompt gui during runtime if you wish.

When using the method “SetCustomGui” you NEED to call it before calling any other methods once.

You can use this method as much as you’d like. The only rule that you need to consider is that you call it before calling any other methods. Otherwise, the old gui will be used.

local PromptClass = require(game.ReplicatedStorage.Prompt)

PromptClass:SetCustomGui(game.ReplicatedStorage.CustomPromptGui)


local MyPrompt = PromptClass.new()

This will replace the current prompt gui with a custom one to be used during runtime.

To interact with the prompt there are currently two methods available called “SetLabels” and “SetOptions”


  • “SetLabels()” Accepts a dictionary to set the text and title of the prompt to.

  • “SetOptions” Accepts a dictionary to set each buttons text to.

  • “Destroy()” Destroys the prompt and disconnects all events bound to it.

  • “DestroyAll()” Part of the main module not inherited. Calls “Destroy()” on all active prompts.


To catch inputs from the prompt. You can hook up an event to the property “Triggered” returned by the prompt. Once triggered. It will fire the signal along with the text of the button that fired it.

By default once the prompt gets triggered. It will terminate itself. This can’t be disabled currently.

local PromptClass = require(game.ReplicatedStorage.Prompt)


local MyPrompt = PromptClass.new()


MyPrompt:SetLabels({
	Title = "Test prompt",
	Text = "Hello, world!"
})

MyPrompt:SetOptions({OptionA = "Hi", OptionB = "Mom"})

MyPrompt.Triggered:Once(function(Option: string)
	print(Option)
end)

That’s about it. Now you’ve got yourself a working prompt that took seconds to set up.

If you have any feedback/ideas/improvements you think I should add. Please leave them in the replies and ill get to em as soon as as possible. :slightly_smiling_face:

1 Like