So I have made a script for a npc dialog and the script doesn't work, I have three types of scripts which are module, local, and a server script and I have got a remote function as well but the scripts just won't work
--//Scripts//--
--Module--
local module = {}
function module.SayDialog(text,tweentime,between,specialwords)
local words = {}
while string.len(text) > 1 do
local edittext = text
local num = string.find(edittext," ")
local word = string.sub(edittext,1,num)
text = string.sub(edittext,num+1)
table.insert(words,word)
end
local currentx = 0
local currenty = 0
local framex = script.Parent.AbsoluteSize.X
local tweeninfo = TweenInfo.new(tweentime,Enum.EasingStyle.Quad,Enum.EasingDirection.Out)
for i,x in pairs(words) do
local d = script.Parent.Defualt:Clone()
d.Parent = script.Parent.Text
d.Text = x
local sizex = d.TextBounds.X
d.Size = UDim2.new(0,sizex,0,48)
if currentx+sizex > framex then
currenty=currenty+48
currentx = 0
end
for v,r in pairs(specialwords) do
if r.Word == x then
d.TextColor3 = r.Color
end
end
d.Position = UDim2.new(0,currentx,0,currenty+48)
d.Rotation = math.random(-30,30)
currentx = currentx + sizex
d.Visible = true
game:GetService("TweenService"):Create(d,tweeninfo,{Position = UDim2.new(0,d.Position.X.Offset,0,d.Position.Y.Offset-48), Rotation = math.random(-3,3), TextTransparency = 0}):Play()
wait(between)
end
end
return module
--LocalScript--
local module = require(script.Parent.ModuleScript)
local ifplaying = false
game.ReplicatedStorage.NPCSpeak.OnClientEvent:connect(function(text)
if ifplaying == false then
ifplaying = true
script.Parent:TweenPosition(UDim2.new(0.5,0,0.65,0),Enum.EasingDirection.Out,Enum.EasingStyle.Back,1)
wait(1)
local wordtime = 0
for v,r in pairs(text) do
script.Parent.Text:ClearAllChildren()
wordtime = string.len(r.Text)*0.04
local coloredwords = {}
for s,q in pairs(r.Colored) do
local tab = {Word = q.Word,Color = q.Color}
table.insert(coloredwords,tab)
end
module.SayDialog(r.Text,0.6,0.15,coloredwords)
wait(wordtime)
end
script.Parent:TweenPosition(UDim2.new(0.5,0,1,0),Enum.EasingDirection.In,Enum.EasingStyle.Back,1)
end
end)
--Script--
for i,x in pairs(game.Workspace.NPCs:GetChildren()) do
x.Region.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local tab = {}
for o,p in pairs(x.QuestLine:GetChildren()) do
for s,q in pairs(p:GetChildren())
local texttab = {
Text = q.Value.." ",
Colored = {},
}
for v,r in pairs(q.Colored:GetChildren()) do
local colortab = {
Word = r.Name.." ",
Color = r.Value,
}
table.insert(texttab.Colored,colortab)
end
table.insert(tab,texttab)
end
game.ReplicatedStorage.NPCSpeak:FireClient(game.Players[hit.Parent.Name],tab)
end
end)
end
--end--
Please help as soon as possible

2 comments
At line 78 you are missing a 'do'.
Perfect! Thanks for the help!