-
What do you want to achieve? Have a module script fire a remoteEvent when a localscript is getting the info of the module.
-
What is the issue? Script won’t show custom dialog
-
What solutions have you tried so far? N/A
Ok I tried to make a script that would call the module script to make a dialog box show up. I’m not exactly sure what’s going on so Imma so you pictures of it now:
Examples so far:
gyazo.com/2a73826bba4ef7f1ba1fc8ba269accf0.png
gyazo.com/c683714d30ad4fe1e9d83888a4113b45.png
I’m a little confused because it’s rushed
Edit: I made it easier by simply printing it
gyazo.com/bc30d4b0db24308a34e7e39a8e7c9888.png
Can you show us the code that handles the remote event Workspace.Main.Dialog
?
Also did it print the string "HELLO"
when you edited the function to call print
on the input of the function ShowMessage
rather then send it to the server using the remote event Worksapce.Main.Dialog
?
1 Like
Yes. in the function it did print hello.
Then I will reiterate what I said in my last post.
It would be helpful if we could see your code so we can perhaps further deduce the issue.
gyazo.com/4b6c21040b9e9970bbf6914fea2adc15.png
ignore the rest of the code just read modle:ShowMessage
Did I already show you this?
Did you mean this?
gyazo.com/e041b388ac0191a0ef395dda5b7073df.png
while running modules will not execute if not called
Yes you already showed me that.
I am interested in the code that handles the OnServerEvent
signal for the workspace.Main.Dialog
RemoteEvent. Not the code you have showed me.
more looks like OnClientEvent i think
Your script here:
Looks like it is a LocalScript
. And it looks like you’re trying to handle the RemoteEvent
on the client when the :FireServer
is on the client. You have a significant problem in a lot of the code here.
What you will need to do is ship the code handling the Remote to the server and to instead use OnServerEvent
and you will have to change how you reference the variables like Window
and Player
.
Perhaps you should try reading this (and if you have, read it again):
Module:
local Dialog = {}
function Dialog:ShowMessage(Message)
workspace.Main.Dialog:FireServer(Message)
end
return Dialog
LocalScript:
local Dialog = require(game.ReplicatedStorage.Modules.Dialog)
Dialog:ShowMessage("Hi")
Script:
workspace.Main.Dialog.OnServerEvent:Connect(function(Player, Message)
print(Message)
end)
Does it output the Message
? If so you can then likely integrate your other functionality. If not, any errors?
yes and I completed it (kinda, I want another dialog to show just after that dialog was just closed)
workspace.Main.Dialog.OnServerEvent:Connect(function(Player, Message)
local PlayerGui = Player:WaitForChild("PlayerGui")
local MainGui = PlayerGui:WaitForChild("MainGui")
local Dialog = MainGui["Main"]["Dialog"]
local Label = Dialog.Label
Label.Text = Message
Dialog.Visible = true
local Ok = Dialog["Ok"]
Ok.MouseButton1Click:Connect(function()
Dialog.Visible = false
end)
end)
In action:
gyazo.com/217546ac067e6f980be734fde351c052