How do i create an animated dialogue system or 2D cutscene?

im making a visual novel-ish game anddd…
i would like my dialogue to play gifs on the UI(audio included would be great) and another one if the player presses a particular key on the keyboard but i dont know how to.

here is something i want to achieve (hope this explains it)

and also how to make the player temporarily unable to move/control because it is a cutscene and moving would bad lol

[please note that im a very big noob in scripting😭(im just an artist) so if you’re kind then a good explanation will help me a ton.]

thanks!

5 Likes

Curently, GIFs or Videos in general are inaccessible to the general public. They will be when VideoFrames will be able to support community-posted videos.

To make the player unable to move, you’d have to stun them, which is usually done by setting their walkspeed and jump power to 0 like such:

character.Humanoid.WalkSpeed = 0
character.Humanoid.JumpPower = 0

At last, for the dialogue there’s no simple answer. You’d have to store the lines in a table like such:

local lines = {
    "This is line 1.",
    "This is line 2."
}

After that, to detect user input, or the key they need to press you’d have to utilize UserInputService, like so:

local UserInputService = game:GetService("UserInputService")

UserInputService.InputBegan:Connect(function (input, gameProcessedEvent)
	if gameProcessedEvent then return end
	if input.KeyCode ~= Enum.KeyCode.Space then return end
	
	-- continue dialogue.
end)

Overall, for a beginner this is no easy job and you may want to consider doing something easier. If not, though, this is a template code that you can use to help you.

local lines = {
	"This is line 1!",
	"Line 2...",
	"Finally, line 3!"
}

local ScreenGui = PUT_SCREEN_GUI_HERE
local DialogueTextLabel = PUT_TEXT_LABEL_HERE

local currentLine = 1
game:GetService("UserInputService").InputBegan:Connect(function (input, gameProcessedEvent)
	if gameProcessedEvent then return end
	if input.KeyCode ~= Enum.KeyCode.Space then return end
	
	currentLine = currentLine + 1
	local lineText = lines[currentLine]
	
	if not lineText then
		return -- NO MORE LINES
	end
	
	DialogueTextLabel.Text = lineText
end)
3 Likes

oh my god TYSM FOR HELPING MEE!!

ill try to somehow code the gif part myself

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.