Fire Remote Event to Client Not Working

Local Script

local RS = game:GetService("ReplicatedStorage")
local Folder = RS:WaitForChild("Remotes")
local RE = Folder:WaitForChild("RE")

local function invisible(playergui)
	--if playergui then
		print("Remote Fired")
		playergui.Positions.Frame2.Visible = false
		playergui.Positions2.Frame.Visible = false
	--end
end

RE.OnClientEvent:Connect(invisible)

Server

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		local BoolValue = Instance.new("BoolValue", char)
		BoolValue.Name = "IsPlayer"
		
		local RS = game:GetService("ReplicatedStorage")
		local Folder = RS:WaitForChild("Remotes")
		local RE = Folder:WaitForChild("RE")
		local playergui = player:WaitForChild("PlayerGui")
		
               RE:FireClient(player, playergui)
end)
end)

I want the remote event to fire once a player joins the game the two guis goes invisible. There no errors and the remote event fires.

Confused as to why you’re passing the Player’s PlayerGui to the client; the client can access the PlayerGui just fine via:

local localPlayer = game:GetService("Players").LocalPlayer
local playerGui = localPlayer:WaitForChild("PlayerGui")
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.