Toggling visibility of UI elements

edit: I did figure out the main issue.

I'm new to Lua and have just been trying to get a handle of how I can use a script to make changes to variables on other components outside of the script. I've been able to make references to the object I want to change the variable of, but I don't know exactly how to refer to the variable, assuming this is possible in the first place.

Also, do I need to enable networking on the object? I assume that would have to do with a server-side permission, but is it just necessary in order to make changes to variables at runtime?

So, for example, I want to use a script to check the visibility status and enable or disable the visibility of a UI Container object (or anything with a visibility variable, in theory) when I press a keybind. I haven't been able to find the scripts that I assume are included somewhere to deal with the actual exit menu, which could probably show me what to do.

Right now, this is what I have (below). It doesn't work yet. I just guessed at the variable references since I couldn't find more details on it and nothing populated automatically in the script editor. The visibility variable is under the header/component of "Scene," but I don't know if I need to include that somewhere in the reference to the variable. The keybinds also don't work properly (I just found the Ability Bindings - Core Creator Hub so I'll fix that soon). But I'd probably want to change it to being based in/editable by the player in the Settings->Controls menu as well, if there's any information on how that can be done, if it can be.

Script so far:

local propUIElement = script:GetCustomProperty("UIElement"):WaitForObject()
local propKeybind1 = script:GetCustomProperty("Keybind1")
local propKeybind2 = script:GetCustomProperty("Keybind2")

function OnBindingPressed(whichPlayer, binding)
if binding == "ability_extra_" .. propKeybind1 or binding == "ability_extra_" .. propKeybind2 then
if not propUIElement.visiblity == "Forced On" then
propUIElement.visiblity = "Forced On"
else
propUIElement.visiblity = "Forced Off"
end
end
end

function OnPlayerJoined(player)
player.bindingPressedEvent:Connect(OnBindingPressed)
end

Game.playerJoinedEvent:Connect(OnPlayerJoined)

edit:
The main issue seemed to be just not using the proper capitalization and values. I did a few other things, but with this structure, it seems to be working better:

uiElement.visibility = Visibility.FORCE_ON