I have two scripts; a server script, that is inside the dialog:
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RE = Instance.new("RemoteEvent")
RE.Name = "RE"
RE.Parent = ReplicatedStorage
local screen = game.ServerStorage.ScreenGui
screen.Parent = ReplicatedStorage
script.Parent.DialogChoiceSelected:connect(function(pl ,dc)
if dc == script.Parent.OpenShop then
RE:FireClient(pl)
end
end)
and a local script that is inside starterplayerscripts:
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RE = ReplicatedStorage:WaitForChild("RE")
local gui = ReplicatedStorage:WaitForChild("ScreenGui")
RE.OnClientEvent:connect(function(player)
local sgui= gui:Clone()
sgui.Parent = playerGui
end)
they're supposed to open a gui if a dialog is chosen and it works when testing in studio, but not ingame. why is that?
