I am trying to disable a gui with a remote event but it's not working. Here are the scripts:

-- Server script:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvents = ReplicatedStorage:WaitForChild("RemoteEvents")
local LoadFinishedEvent = RemoteEvents:WaitForChild("LoadFinishedEvent")

LoadFinishedEvent:FireAllClients()

-- Local script:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvents = ReplicatedStorage:WaitForChild("RemoteEvents")
local LoadFinishedEvent = RemoteEvents:WaitForChild("LoadFinishedEvent")
script.Parent.Enabled = true
LoadFinishedEvent.OnClientEvent:Connect(function()
	script.Parent.Enabled = false
	print("hello") -- it doesn't print hello
end)

2 comments

0

Make sure that the path to the RemoteEvent exists.

0

It exists and I have no errors.