Hello, for context, each time a dialogue starts your character should be frozen in place. After the dialogue ends, you’ll be able to move again. I have tried to fix this several times, and it’s either the dialogue interface pops up, your character doesn’t freeze and the dialogue is simply “Label”. Or nothing happens, not even the dialogue interface shows up.
Here is my script, I am relatively new to scripting and there is only one set of dialogue for now. My game is still in development, there is a script inside of an invisible part in workspace which fires a remote event:
-- // Variables // --
local replicatedStorage = game.ReplicatedStorage
local events = replicatedStorage.Events
local dialogueBox = script.Parent
local dialogue = dialogueBox.Dialogue
local speaker = dialogueBox.Speaker
local sounds = workspace.Sounds
local dialogueSound = sounds.Dialogue
local currentDialogue = nil
local currentSpeaker = nil
local shortDelay = 3
local mediumDelay = 5
local longDelay = 7
local players = game:GetService("Players")
local localPlayer = players.LocalPlayer
local character = localPlayer.Character
local humanoid = localPlayer:FindFirstChild("Humanoid")
-- // Functions // --
function typewrite()
for i = 1, #currentDialogue do
dialogue.Text = string.sub(currentDialogue, 1, i)
dialogueSound:Play()
wait(0.06)
end
end
function handleDialogueStart()
dialogueBox.Visible = true
speaker.Text = currentSpeaker
humanoid.WalkSpeed = 0
end
function handleDialogueEnd()
dialogueBox.Visible = false
currentDialogue = nil
currentSpeaker = nil
humanoid.WalkSpeed = 10
end
-- // Dialogues // --
events.DumpsterEncounter.OnClientEvent:Connect(function()
currentSpeaker = "You"
handleDialogueStart()
currentDialogue = "Well, the dumpsters are blocking my way. How am I going to get around this? I can't swim."
typewrite()
wait(shortDelay)
currentDialogue = "This is what happens when you work in the sewers, occasional floods... goddammit."
typewrite()
wait(shortDelay)
handleDialogueEnd()
end)