So I have a script in the dialog choice and it's a simple 5 line open script when the choice is selected. But the thing that confirms where the ScreenGui is is underlined, and I don't know why.
---script---
script.Parent.DialogChoiceSelected:connect(function(player, choice) if StarterGui.ShopGui.Frame.Visible == false then StarterGui.ShopGui.Frame.Visible = true end end)
What exactly went wrong in the script?
I am going to reiterate what I said earlier in the initial comments I made.
You are not showing the ShopGui for the player that selected the dialog choice, you are changing the visibility of the ShopGui's frame for the ShopGui that is in StarterGui. When a player joins the game, they will receive a copy of this ShopGui that is in StarterGui.
What you need to do is modify the ShopGui inside of the Player's PlayerGui.
If this is being done in a LocalScript, it will be a simple fix.
Note: :connect is deprecated, use :Connect just to be safe because Roblox could remove the functionality of :connect in the future.
script.Parent.DialogChoiceSelected:Connect(function(player, choice) if player.PlayerGui.ShopGui.Frame.Visible == false then player.PlayerGui.ShopGui.Frame.Visible = true end end)
Now, that's the solution for your problem if you're using a LocalScript.
This is the solution if you're using a server script.
In the LocalScript, type the following.
local Remote = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent") local Player = game.Players.LocalPlayer local Gui = Player:WaitForChild("PlayerGui"):WaitForChild("ShopGui") local Frame = Gui:WaitForChild("Frame") Remote.OnServerEvent:Connect(function() if Frame.Visible == false then Frame.Visible = true else Frame.Visible = false end end)
Modify the server script.
local Remote = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent") script.Parent.DialogChoiceSelected:Connect(function(player, choice) Remote:FireClient(player) end)
It appears that you inserted the "choice" parameter for this event listener, but did not use it. You don't have to insert parameters that you aren't going to use, unless that parameter is returned(chronologically) before ones that are you are going to use.
This is the full solution. I am a bit drowsy right now, so I could have made some errors. If anyone spots one, or multiple, point it or them out please.