Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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.

2 comments

0

You can't access PlayerGui from the server.

0

@incapaz That is not true, you can.

1 answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.