Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 3 years ago

Take 3, turns out my last two questions were for naught and weren't actually my problem.

I need my GUI named "Cover" to become Visible after a RemoteEvent is fired through a ClickDetector picking up a click. However, it seems that either my RemoteEvent isn't firing to the player who clicked/not firing at all, or my onClientEvent isn't picking up the RemoteEvent.

Here are the placements of the scripts:

https://i.imgur.com/vW27kLe.png (My ClickDetector in its parent model, with its script to tell the RemoteEvent to fire)

https://i.imgur.com/qwJ09Bz.png (My RemoteEvent in ReplicatedStorage)

https://i.imgur.com/PtMdNNw.png (My script CoverVisible, which should receive the RemoteEvent and tell the ImageLabel above it to become Visible)

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 clickDetector = script.Parent

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 ReplicatedStorage = game:GetService("ReplicatedStorage")

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)
0
question, is this going to be a gui that everyone sees? because if not, you dont necessarily have to use a remote event if this is happening client side supercoolboy8804 114 — 3y
0
This is a GUI solely for the player. I know I don't /have/ to use a RemoteEvent, but considering the way I'm doing this, I figured I might what to use one. The book model in game with the ClickDetector is server-side, and it needs to communicate to the client-side GUI, is my thought here. ControlCoreAngel 37 — 3y

Answer this question