How do I make a dynamic story game?

Hey.

I want to make a story horror game, but how do I make a story game without inserting a script into every part of the game?

For example, I want jumpscares and certain things to happen at specific parts of the game, but do I need touchparts so that it happens when you reach a certain location? Or is there any other way?

Hope you guys understand and if you dont, please ask me to explain again.

@Alvin_Blox made a good series about how to do this: HOW TO MAKE A STORY GAME ON ROBLOX - YouTube

1 Like

I personally use some sort of “event table” to make scripted games (by “scripted” I mean existing plot). Here is a quick example:

local events = { --An array-like table of "events"
	{ --An event
		storage  = {},
		
		init_callback = function(self)
			print("This function will be called before the waiting!")
		end,
		
		wait_time = 10, --after the event wait 10 seconds

		final_callback = function(self)
			print("This function will be called after the wait!")
		end
	}
}

A quick interpreter for it:

for i, v in ipairs(events) do
	v:init_callback()
	task.wait(10)
	v:final_callback()
end

You can make a similar structure to suit your needs - for example, you can have text which would be used to set the storytelling label’s text.

I used the : syntax, which passes the table you used - for example, sometable:abc() is equivalent to sometable.abc(sometable), so the function gets access to sometable. That way you can store connections in storage and then disconnect them when unnecessary, so you can make a part damage players after an event and then disconnect the connection to Touched when the event ends. You can create a system for multiple events to access storage if you need that.

If you need it, here is the type of the event structure I used:

type Event = {
	storage: {[any]: any}, --Create specific event types for each event if you want a more precise type for "storage"
	init_callback: (Event) -> (), --It's better to make this and final_callback optional, you should do that with a few simple if statements
	wait_time: number,
	final_callback: (Event) -> ()
}
1 Like

And I can use this module scripts too right?

thanks, i will look into that : )