Cafe Menu GUI pops up when first talking to NPC but if I go back to the NPC it won't work?

Basically I used the Official Roblox Dialogue System and Dialogue Editor Beta with this plugin. You may ask why I used this plugin. It’s because the official plugin isn’t maintained anymore. When you go to the NPC it asks if you want a menu to a cafe. If you say “Yes, I want a menu” a Menu GUI will pop up. You see it works on the first time you talk to the NPC but if you talk to the NPC twice after the Menu has already been opened the GUI won’t pop up. Here is the code that makes the menu pop up when the player selects yes.

--execute code when this response is chosen
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data
return function(player, dialogueFolder)
	print(tostring(player.PlayerGui.PromenadeMenu.Frame.Visible))
	player.PlayerGui.PromenadeMenu.Frame.Visible = true
	print(tostring(player.PlayerGui.PromenadeMenu.Frame.Visible))
	print("Shown")
end

On the first attempt the output shows:

false
true
Shown

But then when I go back to the NPC again and do the same actions the output shows:

true
true
Shown

Also, I don’t think this is related but in the menu GUI if the player wants to exit the GUI they press the “X” button which just makes the GUI Visible set to false.

When the player clicks X
script.Parent.MouseButton1Click:Connect(function()
    script.Parent.Parent.Visible = false
end)

My theory is that the NPC sets the menu GUI visible on the server-side and the player makes the Menu Invisible on the client-side meaning that the server still thinks that its set to true even though the player set it false on the client-side. I don’t know if this true or not but if anyone has any solutions regarding this it would be appreciated!

This is true. You can fix this by setting the gui to true on the client side.

Think of it like this, whenever you change something on the server, it cannot be changed through the client. Roblox does this to prevent exploiting.

I hope this helped! If it did mark this post as “Solution” so other people can easily find answers to similar problems.

1 Like

Official Solution: Make a remote event and fire it from the NPC and send it to the client to do the code instead of doing the code on the server-side.

1 Like