Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to make a shop open when the player talks to an NPC?

I want to make my shop GUI visible when the player asks my NPC to view the items on sale. I have no idea how to do this, as DialogChoiceSelected does not work with FE, and my game needs to be FE compatible. How will I achieve this?

3 comments

0

This is not a request site, my own post got taken down for no reasonable action

0

He isnt asking for a script hes asking for a solution

0

dialog guis dont work with fe unless there are remoteevents or some other stuff

2 answers

Try making a Dialog inside an NPC's Head. There Should be "Choice1" and "Choice2" inside, otherwise you can just make more dialog replies.

Try putting this script inside the Dialog:


--MAKE SURE YOU DON'T COPY THE COMMENTS
local Dialog = script.Parent

Dialog.DialogChoiceSelected:connect(function(Player, Choice)
if not Player then return end
-- Choice1 is the name of the reply dialog in which the player will choose inorder to activate the gui, 
if Choice.Name == "Choice1" and Player.PlayerGui:findFirstChild("NAMEOFYORUGUI")--[[this makes sure that the player doesn't receive the same gui twice.]] == nil then

local Gui = script.NAMEOFYOURGUI:clone() -- change NAMEOFYOURGUI to the name of your gui and make sure to put it under the script.
Gui.Parent = Player.PlayerGui
end
end)

2 comments

0

OK, I'm gonna try this. I have a question though, is this FE compatible?

0

Hey, I tried this. It works pretty well in Studio, but then I realized in a Local Server that I had been making the same mistake. DialogChoiceSelected, unfortunately, does not work with FE.

Since DialogChoiceSelected does not work with FE, I used a ClickDetector instead. It worked.

This discussion is preserved as it was. New answers, comments, and votes are closed.