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

Reposting, since it's been about 3 days and I'm still having this issue.

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.

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:

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
clickDetector.ClickDetector.MouseClick:Connect(onClicked) Make sure that you insert click detector on the part of the model you want to be clicked on SwagOnDex 5 — 3y
0
I've already done this and this isn't my issue. ControlCoreAngel 37 — 3y

Answer this question