Script for making a frame appear on dialog doesn't work

I made this script for a tutorial npc, and he is supposed to make a frame with a quest pop up when you select a certain dialog option. This script is a localscript in StarterPlayerScripts.

pilot training.rbxl (259.0 KB)

local dialog = game.Workspace.Ryanthemudkip.Head.Dialog
local client = game:GetService("Players").LocalPlayer

dialog.DialogChoiceSelected:Connect(function(player, choice)
    if player ~= client then
        return
    end
    
    if choice.Name == "Dialogchoice1" 
game.StarterGui.quests.Quest1.Visible = true
    end
end)

Your player’s gui is not located in StarterGui once they join. Player’s gui is located in

Local Player → Player Gui

change that to

client.PlayerGui.quests.Quest1.Visible = true
1 Like

I tried this, but it still doesn’t appear. Thanks for the help :slight_smile:

You also forgot to add a then on this line

if choice.Name == "Dialogchoice1"  --where's 'then'?
1 Like

I added it, but still don’t see it.

Is the dialog choice actually named “Dialogchoice1”? (case and spelling sensitive)

1 Like

Yes, it is. The path is complete correct.

Could you debug your own code to try and figure out why this isn’t working? Check for any console errors, then check what lines of your code are or aren’t running. You need to isolate the problem to better help yourself ask us for help, saying “it doesn’t work” is never sufficient enough explanation.

1 Like

Nothing appears in the console, and the code all seems to be correct. I’ve double checked for spelling and capitalization.

Is the UI within the screen region?
Is the UI not transparent?

If I manually make it visible, it is there.

Well, there’s not enough information for us to help you properly. At this point, uploading a demo place would be the best option.

1 Like

Edited the post with the file.

I said that the dialog name was case sensitive -_-

The object is named “DialogChoice1”, your script has “Dialogchoice1”

That’s strange, it’s capitalized correctly for me, but still doesn’t show up.

If you’ve made all the necessary changes I’ve mentioned, it should be working. It works fine for me.

1 Like