-
What do you want to achieve?
Dialogue with the NPCs using click detector and guis -
What is the issue?
When I use two NPCs, When I finish chatting to one then chat to the other, this happens:
In the video, Vegeta is supposed to say:
but instead he just uses Piccolo’s line
script inside Piccolo’s click detector
script.Parent.MouseClick:Connect(function(playerclicked)
game.ReplicatedStorage.NPCQuest:FireClient(playerclicked,"Piccolo","Hmph. What is it.","Can you train me?","This feature is coming soon. So no, I'm not training you.","Nothing, sorry.",script.Parent.Parent.Parent.Parent)
end)
script inside Vegeta’s click detector
script.Parent.MouseClick:Connect(function(playerclicked)
game.ReplicatedStorage.NPCQuest:FireClient(playerclicked,"Vegeta","It's me, The PRINCE OF ALL Saiyans. What do you want.","wot","WHAT DO YOU MEAN WHAT? ARE YOU TRYING TO DISRESPECT ME?","Nothing, sorry.",script.Parent.Parent.Parent)
end)
script inside gui
game.ReplicatedStorage.NPCQuest.OnClientEvent:Connect(function(npcname,npcdialogue1,choice1,npcdialogue2,choice2,npc)
local camera = game.Workspace.CurrentCamera
camera.CameraSubject = npc.HumanoidRootPart
script.Parent.Visible = true
script.Parent.Choice1.Visible = true
script.Parent.Choice2.Visible = true
script.Parent.NpcText.TextVal.Value = npcdialogue1
script.Parent.NameTe.Text = npcname
script.Parent.Choice1.Text = choice1
script.Parent.Choice2.Text = choice2
script.Parent.Choice1.MouseButton1Click:Connect(function()
script.Parent.NpcText.TextVal.Value = npcdialogue2-- the text has a value in it that has a while true do script so that it matches the dialogue text
script.Parent.Choice1.Visible = false
script.Parent.Choice2.Visible = false
wait(3)
script.Parent.Visible = false
script.Parent.NameTe.Text = ""
script.Parent.NpcText.TextVal.Value = ""
camera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
end)
script.Parent.Choice2.MouseButton1Click:Connect(function()
script.Parent.Visible = false
script.Parent.NameTe.Text = ""
script.Parent.NpcText.TextVal.Value = ""
camera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
end)
end)
