Help with a remote event and a GUI

Hello developers,

I know this sounds stupid, but I’m having issues firing a remote event on the client and then it not working. (no errors provided)

Here is my script from the server: (also yes I’m currently using a dialogue system, don’t ask please)

local gate = game.Workspace.Castle.Folder.Gate
local gateL = gate["Left door"]
local gateR = gate["Right door"]

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local enableScreenGuiEvent = ReplicatedStorage:WaitForChild("Fade", 5)

local Action = {};



local function freezeAllPlayers()
	for _, player in Players:GetPlayers() do
		if player.Character and player.Character:FindFirstChild("Humanoid") then
			local humanoid = player.Character.Humanoid
			humanoid.WalkSpeed = 0
			humanoid.JumpPower = 0
		end
	end
end

Action.Synchronous = false;	-- Stops the player from proceeding to the next dialogue/leaving
-- the conversation until the action is complete.
-- Note: If this is an "action before" function,
-- this causes the dialogue box to be *blank*
-- until the action is complete.

Action.Variables = function(player)

	-- This function is ran prior to the Execute function.
	-- It's meant for setting conversation variables.
	-- It's helpful if you want this to be an asynchronous action,
	-- yet need to set variables for the dialogue that'll appear next.

	return {};	-- These variables will overwrite any conversation variables you describe.
	-- You can call these variables in your dialogue by using 
	-- [/variable=REPLACE_WITH_VARIABLE_NAME]

end 

Action.Execute = function(player)

	game.Workspace.Gatekeeper.Torso.ProximityPrompt.Enabled = false
	freezeAllPlayers()
	wait(1)
	local gateLPivot = gateL:GetPivot()	
	local gateRPivot = gateR:GetPivot()

	-- Open the gate
	game.SoundService.GateOpen:Play()
	for i=1, 90, 1 do
		gateL:PivotTo(gateLPivot * CFrame.Angles(0, math.rad(-i), 0))
		gateR:PivotTo(gateRPivot * CFrame.Angles(0, math.rad(i), 0))
		wait(0.013)
	end
	enableScreenGuiEvent:FireAllClients()
	
	wait(1)
	
	game.SoundService.GateClose:Play()
	for i=89, 0, -1 do
		gateL:PivotTo(gateLPivot * CFrame.Angles(0, math.rad(-i), 0))
		gateR:PivotTo(gateRPivot * CFrame.Angles(0, math.rad(i), 0))
		wait(0.013)
	end

end;

return Action;

Here is my script from the client:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local enableScreenGuiEvent = ReplicatedStorage:WaitForChild("Fade", 5)
local player = game.Players.LocalPlayer
local screenGui = player:WaitForChild("PlayerGui", 5):WaitForChild("Fade", 5)
local TweenService = game:GetService("TweenService")

local function enableScreenGui()
	local screenGui = game.StarterGui:FindFirstChild("Fade")
	if screenGui then
		screenGui.Enabled = true
		local frame = screenGui.Frame
		local good = frame.Good
		local luck = frame.Luck
		
		frame.Visible = true
	end
end

enableScreenGuiEvent.OnClientEvent:Connect(enableScreenGui)

This might be a waste of time, sorry, but I really need the help! Also, the script is to enable a screen gui on the client. (for everyone)

Thank you! :heart:

The issue is, assuming that everything here works as it should, that you are attempting to enable the general copy of the ScreenGui instance. If you want it to show on the players, your script needs to read:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local enableScreenGuiEvent = ReplicatedStorage:WaitForChild("Fade", 5)
local player = game.Players.LocalPlayer
local screenGui = player:WaitForChild("PlayerGui", 5):WaitForChild("Fade", 5)
local TweenService = game:GetService("TweenService")

local function enableScreenGui()
	local screenGui = player.PlayerGui.FindFirstChild("Fade") -- this changed to PLAYERGUI
	if screenGui then
		screenGui.Enabled = true
		local frame = screenGui.Frame
		local good = frame.Good
		local luck = frame.Luck
		
		frame.Visible = true
	end
end

enableScreenGuiEvent.OnClientEvent:Connect(enableScreenGui)
1 Like

Thanks! I’ll check it out and see if it resolves my problem.

Thank you for your time! It works! I just had to adjust some things since there was 1 thing wrong but then it worked!

No problem!

Remember that the “StarterGui” folder is the folder which the game stores Guis in for every player. If you want to edit something on one player, or on a player who’s Guis have already loaded, you need to do it in the player’s “PlayerGui” folder, as this is what the player actually sees!

1 Like

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