Hello, i’ve made a dialogue system and in my localscript i needed to use :InvokeServer() so i can check something from server but it barely fire, and it works only sometimes, ive tried so many things but i couldn’t find the issue
LOCAL SCRIPT:
spawn(function()
for i,v in pairs(game.Workspace.NPCs:GetChildren()) do
if v:FindFirstChild("ClickDetector") ~= nil and v:FindFirstChild("Quests") ~= nil then
if v.Quests:FindFirstChild("Quest") ~= nil then
if QuestsList[v.Quests.Quest.Value] then
v.ClickDetector.MouseClick:connect(function()
if DialogueFrame.Visible == false then
if Data.ActiveQuest.Value == "" then
local Check = GetRemote:InvokeServer(Player.Name,"Dialogue",v,v.Quests.Quest.Value)
repeat
wait()
until Check ~= nil
print(Check)
if Check == true then
-- Rest of the code
GetRemote.OnServerInvoke = function(Player,PName,Name,NPC,QuestName)
print("1")
if Name == "Dialogue" then
if Player.Name == PName and game.Workspace:FindFirstChild(Player.Name) then
I can’t figure out the issue here if anyone can help
I guess i solved it by putting this line local QuestsList = require(game.ReplicatedStorage:WaitForChild("Quests"):WaitForChild("QuestsList"))
under this line v.ClickDetector.MouseClick:connect(function()
and it somehow worked without breaking now, i’m so confused right now
It’s tough to say without seeing all of the code. You’ve only shown us the first half. I’m guessing something happens after the if check == true then line.
that part is not necessary cuz the problem is from the invokeserver line
it returns “nil” most of the time and i’ve tried putting a print before and after it and they all print