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

ImageLabel not hiding when clicking a TextButton?

Asked by 2 years ago

I'm making a ghost hunting game, where you have a camera system. When I click the TV it works perfectly fine and opens up GUI but when I click Close button it just hides login frame and the button and not the camera overlay/cameras frame.

Server script (in ClickDetector):

event = game.ReplicatedStorage:WaitForChild("CloseCameras")

script.Parent.MouseClick:Connect(function(player)
    player.PlayerGui:WaitForChild("SecurityCameras").Mainframe.LoginMain.Visible = true
    player.PlayerGui:WaitForChild("SecurityCameras").Mainframe.Close.Visible = true
end)

function closeCameras(player)
    player.PlayerGui:WaitForChild("SecurityCameras").Mainframe.LoginMain.Visible = false
    player.PlayerGui:WaitForChild("SecurityCameras").Mainframe.Overlay.Visible = false
    player.PlayerGui:WaitForChild("SecurityCameras").Mainframe.Close.Visible = false
end

event.OnServerEvent:Connect(closeCameras)

LocalScript (in Close button):

event = game.ReplicatedStorage:WaitForChild("CloseCameras")
local player = game.Players.LocalPlayer
local character = player.Character
local camera = game.Workspace.CurrentCamera

script.Parent.MouseButton1Click:Connect(function()
    event:FireServer(player)
    camera.CameraSubject = character.Humanoid
    camera.CameraType = "Custom"
    camera.CFrame = character.Head.CFrame
    script.Parent.Parent.LoginMain.LoginBackground.HiddenText.Text = ""
end)

It seems to be working without any error in output, as I searched the script name in output (workspace.Van.TV.Screen.ClickDetector.Detect) it displayed nothing. Is there any way i can fix this? Is it normal that ImageLabels are not able to be hidden via script? I tried everything but it didn't work.

Any help would be great!

0
In the server script, I see that the Overlay gets toggled to false in the second function, but I don't see the Overlay getting toggled to true in the first function. Also, generally, any GUI scripts should be done locally, so I would just make one RemoteEvent with a true/false parameter for toggling on/off. Also, I'm a bit unclear on the question, could you send pictures of your problem? kodymarcey 49 — 2y
0
explorer view (i changed name of overlay): https://snipboard.io/xWQA64.jpg second image: https://snipboard.io/ktnp1g.jpg GamerLighting23233 63 — 2y

Answer this question