-
What do you want to achieve?
Make a NPC chat system with GUIs -
What is the issue?
The chat is all mixed up. The NPC says stuff the player is supposed to say. And sometimes they both say the same stuff. -
What solutions have you tried so far?
I worked on this for over 3 hours.
HERE IS MY CODE
NPC CODE
local button = script.Parent
local plr = game.Players.LocalPlayer
local function onButtonActivated()
plr.PlayerGui.ScreenGui.GameFrame.ReplyLabel1.Visible = true
plr.PlayerGui.ScreenGui.GameFrame.ReplyLabel1.Text = button.CurrentQuestion.Value.Value
if button.CurrentReply:FindFirstChild("Question") then
button.CurrentText.Value = button.CurrentReply.Question.Value
print(button.CurrentText.Value)
end
end
button.Activated:Connect(onButtonActivated)
THE CODE INSIDE OF THE SCREEN GUI
local button = script.Parent
local function onButtonActivated()
script.Parent.Visible = false
local Dialog = script.Parent.Parent.Parent.Parent.SurfaceGui.Dialog
Dialog.Text = Dialog.CurrentReply.Value.Value
if Dialog.CurrentReply.Value:FindFirstChild("Question") then
Dialog.CurrentReply.Value = Dialog.CurrentReply.Value.Question
Dialog.CurrentReply.Value.Used.Value = true
if Dialog.CurrentQuestion.Value:FindFirstChild("Reply") then
Dialog.CurrentQuestion.Value = script.Parent.Parent.Parent.Parent.SurfaceGui.Dialog.CurrentQuestion.Value.Reply
Dialog.CurrentQuestion.Value.Used.Value = true
end
end
end
button.Activated:Connect(onButtonActivated)
PLEASE HELP ME