Still have questions? Join our Discord server and get real time help.
Log in to vote

My Dialog System Only Works In Test Mode?

Asked by 2 years ago

I usually don't have this problem, as I already know that filtering enabled doesn't take effect for play mode in studio, but test servers in studio does use it - leading to different outcomes when testing. In my instance, I am using DialogChoiceSelected event to open up a Shop Gui. This system works perfectly when in play mode, but not when I open up a server.

Here's the script:

local dialog = script.Parent
local DialogEvent = game.ReplicatedStorage.DialogEvent
print("loadded") -- this is the only message that prints.

dialog.DialogChoiceSelected:connect(function(plr, choice)
    print('dialog selected :D')
    if choice.Name == "AskForShop" then
        DialogEvent:FireClient(plr, "Shop")
        print('fired to client')

Yes, I made sure that all the names were right, and as I said before, the function is only fired when in play mode, not in server mode. Weird.... Any solutions?

I never got my dialog scripts to work. ILikeTofuuJoe 1 — 2y
I just saw that plr is a nil value. It does not exist in your script. ILikeTofuuJoe 1 — 2y
it;s not nil, it is the first of two arguments passed to function(plr, choice) by the dialogChoiceSelected event. This part of the code is correct. Nonaz_jr 439 — 2y

1 answer

Log in to vote
Answered by
Nonaz_jr 439 Moderation Voter
2 years ago

Dialogs have some problems working in FE.

There are ways to make it work, but it involves overcoming for example this problem:

DialogChoiceSelected fired locally. That means you must put the function you connect to that event must be connected in a local script instead.

To do things on the server you must then have that localscript fire your remoteEvent, which your script on the server will listen to. That script needs to be on the server to assign items, etc, but if you just want to open your GUI, you don't need the whole remoteEvent, as you are already local.

So move this to a localscript and remove line 8. Does that solve your problem?

Keep in mind there are more 'unusualities' (/bugs) associated with dialogs in FE, I recommend playtesting everything carefully or moving to a custom conversation GUI.

wow... it did work. too bad the wiki says you have to use a server script. thank you anyways! laughablehaha 489 — 2y

Answer this question