local player = game.Players.LocalPlayer local CreateDialogueEvent = game.ReplicatedStorage.CreateDialogueEvent local DialogueFrame = player.PlayerGui.TalkingNPC.Frame
local function playSound(sound_id) local sound = Instance.new("Sound",game.ReplicatedStorage) sound.SoundId = sound_id sound.Volume = .1 sound.PlayOnRemove = true sound:Destroy() end
local function textAnimate(content) for i = 1,string.len(content) do DialogueFrame.Text.Text = string.sub(content,1,i) playSound("rbxassetid://179235828") 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
local player = game.Players.LocalPlayer local CreateDialogueEvent = game.ReplicatedStorage.CreateDialogueEvent local DialogueFrame = player.PlayerGui.TalkingNPC.Frame local function playSound(sound_id) local sound = Instance.new("Sound", game.ReplicatedStorage) sound.SoundId = sound_id sound.Volume = .1 sound.PlayOnRemove = true sound:Destroy() end local function textAnimate(content) for i = 1, string.len(content) do DialogueFrame.Text.Text = string.sub(content, 1, i) playSound("rbxassetid://179235828") 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
I don't know where you put this, but it appears this is happening because this directory in your game does not exist. There are three reasons this can be the case:
Double check for the first two. If those aren't the case, it is #3. In that case you can use :WaitForChild(). Here is how you do so:
local player = game.Players.LocalPlayer local CreateDialogueEvent = game.ReplicatedStorage.CreateDialogueEvent local DialogueFrame = player.PlayerGui:WaitForChild("TalkingNPC").Frame --Right here is where we do it. Btw WaitForChild is a good practice since many things are often not loaded in (or you can use your own waitforchild if you decide to script your own function for it) local function playSound(sound_id) local sound = Instance.new("Sound", game.ReplicatedStorage) sound.SoundId = sound_id sound.Volume = .1 sound.PlayOnRemove = true sound:Destroy() end local function textAnimate(content) for i = 1, string.len(content) do DialogueFrame.Text.Text = string.sub(content, 1, i) playSound("rbxassetid://179235828") 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