GUI won't become Visible after RemoteEvent fires via a ClickDetector?

I’ve gotten no help from ScriptingHelpers on this regard yet, and while I got some assistance from Reddit, I’ve had no luck so far.
Copypasted from ScriptingHelpers and Reddit.

I need my GUI named “Cover” to become Visible after a RemoteEvent is fired through a ClickDetector picking up a click. My RemoteEvent fires, however the LocalScript doesn’t pick it up- this was confirmed via use of Print commands.

Note this GUI will only be visible to the player who clicked on the model with the ClickDetector.

Here are the placements of the scripts:


Before I get questions about it: yes, the ScreenGui the ImageLabel is under is Enabled, and the Frame it’s also under is Visible.

Here are my scripts:

DinosaurBookOpen (should receive the click from the ClickDetector and tell the RemoteEvent to fire to the player who clicked the model)

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("DinosaurBook")
local function onClicked(player)
	remoteEvent:FireClient(player)
end
-- Connect the function to the MouseClick event
clickDetector.MouseClick:Connect(onClicked)

CoverVisible (should receive the RemoteEvent and tell the ImageLabel to become Visible)

local remoteEvent = ReplicatedStorage:WaitForChild("DinosaurBook")
local GUI = script.Parent
local function onNotifyPlayer()
	if GUI.Visible == false then
		GUI.Visible = true
	end
end)
remoteEvent.OnClientEvent:Connect(onNotifyPlayer)

I think the "Server script " is located inside a model model’s click detector and the model is located inside Replicated First Service.
No server script will run inside replicated the first service.

I know this maybe is just a little mistake but you didnt specify clickDetector in DinosaurBookOpen
(atleast in the code snippet you gave us) just make sure its an actual variable

by the way, is there anything in the output?

i also think the if statement inside of onNotifyPlayer is kind of useless

try this:

-- DinosaurBookOpen:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("DinosaurBook")

script.Parent.MouseClick:Connect(function()
	remoteEvent:FireClient()
end)


-- CoverVisible:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("DinosaurBook")
local GUI = script.Parent

remoteEvent.OnClientEvent:Connect(function()
	GUI.Visible = true
end)
1 Like

Except the server script runs fine, if you’re referring to DinosaurBookOpen.

See:

My RemoteEvent fires, however the LocalScript doesn’t pick it up- this was confirmed via use of Print commands.

in all honesty, i think you dont even need a remoteevent or whatever you are using right now,

you could probably do this:

-- DinosaurBookOpen:

script.Parent.MouseClick:Connect(function(Player)

Player.PlayerGui.BookRenderer.ModernViewsOfDinosaurs.Cover.Visible = true

end)
2 Likes

While your earlier script didn’t work (output stated something about FireClient was wrong), this one did! Thank you so much, you’ve just helped me with a silly issue I’ve had for AGES.

Can I verify, though, that this would only bring up the GUI for the player who clicked on the model, as opposed to every player in the server? Got a friend to help test it, it DOES only open for the person who clicked it.

I’m doing the same thing with the buttons that change the book’s pages and whatnot, I’ll tell you if this same script doesn’t work for them.

Try this instead:

--// Server Script
local DinosaurBook = game.ReplicatedStorage:WaitForChild("DinosaurBook")

script.Parent.MouseClick:Connect(function(player)
    DinosaurBook:FireClient(player, true)
end)

--// Client
local DinosaurBook = game.ReplicatedStorage:WaitForChild("DinosaurBook")

DinosaurBook.OnClientEvent:Connect(function(visibility)
    gui.Visible = visibility
end)