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

My dialog shop will not work? why?????

script.Parent.DialogChoiceSelected:connect(function(player,dialog)
 local gui = script.Parent.Shop -- Change Shop To The Name Of The Gui.
 if dialog.Name=="DialogChoice" then -- Change The Choice1 To The Name Of The Dialog Choice.
  gui:Clone().Parent = player.PlayerGui
 end
end)

I made a dialog shop that you press a question mark above a bots head and it opens up with questions, you press yes and it opens a GUI. My problem is the GUI will not open when I press Yes

2 answers

✓ Accepted answer

Your LocalScript needs to be a descendant of the player, like StarterCharacterScripts. BillboardGuis and SurfaceGuis are the same. Sure, you can see them, but to register user input, they need to be a part of your player locally.

You can do something like the following. This was a test script, so fix the Parents and names.

~ edit based on Parents image in chat

local model = workspace:WaitForChild('player')
local head = model:WaitForChild("Head")
local Dialog = head:WaitForChild("Dialog")
local gui = Dialog:WaitForChild("Shop")

local me = game.Players.LocalPlayer
local playergui = me:WaitForChild("PlayerGui")

Dialog.DialogChoiceSelected:Connect(function(player,choice)
	if choice.Name == 'DialogChoice' then 
		gui:Clone().Parent = playergui
	end
end)

2 comments

0

:Connect()

0

:Bacon()

Try this:

script.Parent.DialogChoiceSelected:connect(function(player,dialog)
	local gui = script.Parent.Shop
	if dialog.Name=="DialogChoice" then
		local original = gui
		local copy = original:Clone()
		copy.Parent = player.PlayerGui
	end
end)

6 comments

0

:)

0

Why does this work. Explain why.

0

put print("Hi") in between lines 3 and 4 and see if it prints when you click yes.

0

does it?

0

how odd

0

are you 100% percent sure that the dialog is called "DialogChoice"?

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