Gui Frame is allways Visible

I’m trying to make a button that when clicked one Frame turns Invisible and other Visible.

It’s working fine when is a Local Script
But now I need to make in a Server Script and the frame that needs to be Invisible is allways visible.

script.Parent.MouseButton1Click:Connect(function()
   script.Parent.Parent.Visible = false
   script.Parent.Parent.Parent.Frame2.Visible = true
end)

This is the first time that this happend to me.

1 Like
script.Parent.MouseButton1Click:Connect(function()
   script.Parent.Parent.Visible = not script.Parent.Parent.Parent.Frame2.Visible
end)

Try this?

2 Likes

Why are you even doing it on the server?

1 Like

To change a value in a folder inside the player

Didn’t worked, it’s the same result

Instead of doing the gui on server, why don’t you do it on local (since it works fine on local) and fire an event to change the value?

1 Like

It’s to don’t make very scripts and very RemoteEvents in the game

And I already make it works

I put a Server Script to change the value and a Local Script to change the Frames Visibility, but I don’t understand why I can’t disable the Visibility in a Server Script.

local players = game:GetService("Players")

function Visible(player)
    for i, v in pairs(players:GetPlayers()) do
       local gui = v.PlayerGui.  --GUI HERE
       gui.Visible= false --or true
    end
end

script.Parent.MouseButton1Click:Connect(Visible)

Try this on server, will loop through all players to change the visiblility

2 Likes

yes I think you cannot change UI’s in the server since UI is something that’s local. I think that you want to make a UI pop up for everyone. If you want to do that you can make a remoteEvent and fire all clients.

server script:

local remote = game.ReplicatedStorage.RemoteEvent

remote:FireAllClients()

local script:

local remote = game.ReplicatedStorage.RemoteEvent

remote.OnClientEvent:Connect(function()
local UI = game.StarterGui.ScreenGUI.Frame
UI.Visible = true
end)

oops sorry, didn’t realize you already did that :rofl: . My bad mate!! good luck finding a solution :slight_smile:

2 Likes

I know this is already solved, but just to check, is it possible that a local script somewhere else had already set the visibility of these frames.
If so then I believe that local change will override any server side setting of their visiblity, which might be why trying to change it here doesn’t work

1 Like

I know but it don’t have any other local script making this

And I tested in Roblox Player using /console command (Developer Console) and I can show frames in Server Side but not hide, only show.