Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to do I use a RemoteEvent for the Server Script? (FE On)

Asked by 5 years ago

I am making an RPG. But I'm having this issue with this Server Script.

My problem is that this this Script isn't opening up a GUI for me.

Here is the script.

script.Parent.DialogChoiceSelected:connect(function(player,dialog)
 local gui = script.Parent.ScreenGui 
 if dialog.Name=="Choice1" then 
  gui:Clone().Parent = player.PlayerGui
  end
end)

This script used to work when FilterEnabled was off.

I'm really confused with this as I'm a newbie at scripting. I've asked this question many times, and scripters are answering to use a RemoteEvent.

I'm not sure what a RemoteEvent is yet. But if you can help me, please give a clear answer for me.

0
You can't access PlayerGui from the server. User#19524 175 — 5y
0
@incapaz That is not true, you can. NeonProfile 111 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

Alright.

This depends..

If you just want to set something off without a callback (ex. return (variables)) then you will want to use "RemoteEvent", if you do want to use callbacks, then use "RemoteFunctions"

First, Create A remoteEvent inside of ReplicatedStorage. Setup the script inside the GUI Then, send the variables you need. --Client Side GUI

local myRemote = game.ReplicatedStorage.MyRemoteEvent
myRemote:FireServer("Argument1", "Argument2", "Argument3")

-- Server Side

local myRemote = game.ReplicatedStorage.MyRemoteEvent
myRemote.OnServerEvent:connect(function(playerWhoSent, Argument1, Argument2, Argument3)

print(playerWhoSent.Name.." has just sent the server ".. tostring(Argument1).." as argument1!")
end)

This is a basic explanation. Hope this helped.

Ad

Answer this question