Stanley-parable-like narrative

Right now I’m making a game somewhat similar to “doors”, but the game has a narrative in the process

That is, the player enters a section, and the “narrator” says something, depending on what kind of room it is (an ordinary room with nothing special, just a random phrase from the list, or a room with some entertainment, such as choosing where to go, there is a different set of possible phrases, designed specifically for this room)

the problem is that I have no idea how to implement it, where to store the texts and how to access them

One of the ideas is to put a trigger in each room that accesses one of the text files. in theory, this would work well, but special rooms create some problems, because for them I would have to create a lot of such files

I would be grateful if someone could suggest possible options for a more rational implementation of such a system

the perfect solution for you are ModuleScripts

because:

1 you can easly access it by both server and client

2 you can run on “take” instructions from the Modules without modifying it (basically Modules are read only instructions)

3 you can implement a table in the module with all the text lines you want

1 Like

That is, I still need to create hitboxes with different names for special rooms and the same for typical rooms, and the modular script will find these names of hitboxes and output the necessary text?

you can use part.Touched to check whenever something touches the trigger.

then, you can use a remote event that with an argument (which would be the dialogue line)

local module = require(module)

trigger.Touched:Connect(function(touchedPart)
  local plr = game.Players:GetPlayerFromCharacter(touchedParrt.Parent

 if plr then
  remoteEvent:FireClient(plr, module.DialogueLine)
1 Like

so, I need to make a modular script that will store all the functions for a dialog (dialog appearance; its closing; choosing what text will be reproduced; etc.)

make a script for serverScriptService, which will react to the fact that the player interacted with the trigger, what its name is, and receive text from the modular script

and somehow from the script, using remote event, send the text received by the script to the interface?

I apologize if the questions are stupid, programming is hard for me

The fact that I started playing this yesterday.

You should use modulescripts for this with different dialogues and such.

I can’t understand the logic of how to transfer text from a module script to the gui :frowning: