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)
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:
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)