Hi Fellow scripters.
I’m working on a Quest system which has a few server and client events in order to dynamically build the GUI. This means I have two parts of the system.
- localscript
local ReplicatedStorage = game:GetService("ReplicatedStorage");
-- Dialog initializer
ReplicatedStorage.Events.sendDialog.OnClientEvent:Connect(function(who, title, par1, par2, par3, par4, par5, image, isYesNo)
local dialog = script.Parent.Main.Dialog;
print("Retrieved sendDialog")
if dialog.isOpen.Value == false then
print("Done setting up Dialog");
end
end)
And my server script (A part of it)
if contentFolder ~= nil then
local who = contentFolder.Who.Value;
local title = contentFolder.Title.Value;
local par1 = contentFolder.Par1.Value;
local par2 = contentFolder.Par2.Value;
local par3 = contentFolder.Par3.Value;
local par4 = contentFolder.Par4.Value;
local par5 = contentFolder.Par5.Value;
local image = contentFolder.Image.Value;
print(who, title, par1, par2, par3, par4, par5, image, yesNo)
ReplicatedStorage.Events.sendDialog:FireClient(player, who, title, par1, par2, par3, par4, par5, image, yesNo);
print("Sending quest ("..who..") to player "..player.Name);
end
In my situation sometimes print("Retrieved sendDialog") is visible in the console, but sometimes its not. Its very unreliable. Is this normal? If not any idea what i overlook?
The server script is in this case located in a character model which is available in game.Workspace. No that I write this that might be the issue
… Going to rewrite my code so it works from ServerScripServer. Does this matter?
The localscript is located in the StarterGui / player.PlayerGui