chatting.Name = "chatting"
chatting.Value = false
local mouse = game.Players.LocalPlayer:GetMouse()
local function settext(text, talksound, expression)
local textlabel = game.Players.LocalPlayer.PlayerGui.npcchat.TextLabel
textlabel.Text = ""
local imglbl = game.Players.LocalPlayer.PlayerGui.npcchat.ImageLabel
imglbl.Image = expression
for i = 1, string.len(text) do
textlabel.Text = string.sub(text, 1 ,i)
talksound:Play()
task.wait(0.025)
end
end
for i, v in pairs(game.Workspace:WaitForChild("npcs"):GetChildren()) do
v:WaitForChild("hitbox").ClickDetector.MouseClick:Connect(function(plr)
if not chatting.Value then chatting.Value = true
local char = plr.Character or plr.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local mouseclick
local int = 1
local chattable = require(v.chats)
local talksound = v.hitbox.talk
local writing = false
game.Players.LocalPlayer.PlayerGui.npcchat.TextLabel.Text = ""
game.Players.LocalPlayer.PlayerGui.npcchat.Enabled = true
hum.WalkSpeed = 0
hum.JumpPower = 0
settext(chattable[1].text, talksound, chattable[1].expression)
task.wait(0.2)
mouseclick = mouse.Button1Down:Connect(function()
if writing == false then writing = true
int += 1
if int > #chattable then
game.Players.LocalPlayer.PlayerGui.npcchat.Enabled = false
hum.WalkSpeed = 16
hum.JumpPower = 50```
#sound problem on my npc text system script
2 messages · Page 1 of 1 (latest)