im tryna make dialogue system now, but that must write a too many code.
so i wanna make shortcut. i only know that need a modulescript but i dont know how does make like tweeninfo.
example:
local modulescript = path.modulescript
local textinfo = modulescript.TextInfo(
0.2, – text typing speed
“test bro” – text what dialogue want to say
“ok” – a one of choose what i want to say
“no” – a one of choose what i want to say
)
sorry for bad english
Yes, you definitely can (and should) use some form of “configurable objects” to represent data in your dialogue system. TweenInfo are created using the global TweenInfo.new “constructor” function. You can do something similar to represent dialogue with a ModuleScript.
--ModuleScript
local DialogueInfo = {}
function DialogueInfo.new(textSpeed, message, responseList)
return {
TextSpeed = textSpeed,
Message = message,
Responses = responseList
}
end
return DialogueInfo
This can help define multiple “DialogueInfo” objects in a consistent manner from another script that requires the DialogueInfo ModuleScript.
--A different Script, LocalScript, or ModuleScript
local DialogueInfo = require(PATH_TO_MODULE)
local prompt1 = DialogueInfo.new(0.2, "Pick a color", {"Red", "Yellow", "Blue"})
local prompt2 = DialogueInfo.new(0.2, "Pick a number", {"One", "Two", "Three"})
Make sure to mark @East98’s reply as a solution. It helps with easily finding forums that are already solved and also adds a little number to his profile’s solution count.