Dialogue script doesnt work

Why does it not work it says littary nothing in the output or anywhere

Server script

llocal CNT = game.ReplicatedStorage.CreateNewText

– Texts

local function Text_1()
CNT:FireAllClients(“Ouch, that fall hurt! Wait… what is this place?”)
wait(5)
CNT:FireAllClients(“Huh? A yellow door! Wonder how I could unlock it…”)
end

local function Text_2()
CNT:FireAllClients(“no”)
end

– Put the things in order

local function startGame() – This is your main function where we order the challenges
Text_1()
Text_2()
end

startGame()

Local script

local player = game.Players.LocalPlayer
local CNT = game.ReplicatedStorage.CreateNewText
local DialogueFrame = player.PlayerGui.TextUI.Text1
local DialogueText = DialogueFrame:WaitForChild(“Dialogue”)

local function playSound(sound_id) – Plays typing sound
local sound = Instance.new(“Sound”,game.ReplicatedStorage)
sound.SoundId = sound_id
sound.Volume = .1
sound.PlayOnRemove = true
sound:Destroy()
end

local function textAnimate(content) – Animates each letter
for i=1,string.len(content) do
DialogueText = string.sub(content,1,i)
playSound(“rbxassetid://552900451”)
if string.sub(content,i,i) == “!” or string.sub(content,i,i) == “.” or string.sub(content,i,i) == “?” then
wait(1)
elseif string.sub(content,i,i) == “,” then
wait(.5)
else
wait(.05)
end
end
end

CNT.OnClientEvent:Connect(function(content)
DialogueText = “”
DialogueFrame.Visible = true
textAnimate(content)
end)

the text doesnt show up, the sound doesnt play and roblox’s output says its working perfectly fine

Try this

Server Script

local CNT = game.ReplicatedStorage.CreateNewText

-- Texts

local function Text_1()
    CNT:FireAllClients("Ouch, that fall hurt! Wait… what is this place?")
    wait(5)
    CNT:FireAllClients("Huh? A yellow door! Wonder how I could unlock it…")
end

local function Text_2()
    CNT:FireAllClients("no")
end

-- Put the things in order

local function startGame() -- This is your main function where we order the challenges
    Text_1()
    Text_2()
end

startGame()

Local Script:

local CNT = game.ReplicatedStorage.CreateNewText
local DialogueFrame = player.PlayerGui.TextUI.Text1
local DialogueText = DialogueFrame.Dialogue

local function playSound(sound_id)
    local sound = Instance.new("Sound", game.Workspace) 
    sound.SoundId = sound_id
    sound.Volume = 0.1
    sound.PlayOnRemove = true
    sound:Destroy()
end

local function textAnimate(content)
    for i = 1, string.len(content) do
        DialogueText.Text = string.sub(content, 1, i)
        playSound("rbxassetid://552900451")
        if string.sub(content, i, i) == "!" or string.sub(content, i, i) == "." or string.sub(content, i, i) == "?" then
            wait(1)
        elseif string.sub(content, i, i) == "," then
            wait(0.5)
        else
            wait(0.05)
        end
    end
end

CNT.OnClientEvent:Connect(function(content)
    DialogueText.Text = "" -- Clear existing text
    DialogueFrame.Visible = true
    textAnimate(content)
end)
2 Likes

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