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

How to use remote events?

hi so i want to know how you can make remote events to happen server or client to make a gui visible i really need help heres my current attempt

local event = game.ReplicatedStorage.RemoteEvent

script.Parent.ClickDetector.MouseClick:Connect(function()
local player = game.Players.LocalPlayer
local gui = player.PlayerGUI
event:Fire(player,gui)
end)

1 answer

✓ Accepted answer

Here are the steps to your fixed script.

  1. Make sure you have the Remote Event inside of ReplicatedStorage
  2. Have your workspace script set to a regular script
  3. Have a LocalScript inside of StarterGUI.

Next, we get to the scripting part.

Regular Script:

local event = game.ReplicatedStorage:WaitForChild("RemoteEventName")
local clickdetector = script.Parent

clickdetector.MouseClick:Connect(function(player)
event:fireClient(player)
end)

LocalScript:

local event = game.ReplicatedStorage:WaitForChild("RemoteEventName")

event.OnClientEvent:Connect(function()
--Put your desired line of code here
end)

Hope this helped you!

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