-- This script toggles the visibility of your move icons depending on the menu you have open
local pGui = game.Players.LocalPlayer.PlayerGui
function makeVisible(visible)
print("happening")
if visible then
script.Parent.Visible = false
else
script.Parent.Visible = true
end
end
print(pGui.velvetRoomUI:GetChildren())
pGui.fortuneTellerUI.mainUI:GetPropertyChangedSignal("Enabled"):Connect(makeVisible)
pGui.velvetRoomUI:GetPropertyChangedSignal("Enabled"):Connect(makeVisible)
The above code is in a local script.
The print statement for velvetRoomUI works. All the children are listed, meaning that obviously velvetRoomUI exists before I try to connect any events to it.
However, whenever any change in enabled happens to the UI, from server or client, nothing is triggered. “happening” isn’t printed or anything. I even tried with a .Changed event instead of GetPropertyChangedSignal, and it’s the same story.
This is the same for fortunteTellerUI.
Why? How do I fix it?
:GetPropertyChangedSignal doesn’t pass any arguments to the function. It just tells you when it changes, I’ve made this mistake before too, so visible will always be a falsy value, and it will stay visible. Even though *`.Changed does the same thing, but it pass the property that changed. Instead check the actual property manually through script if it’s true or false and run the code normally.
As @Den_vers said, there is no Enabled property for GuiObjects. Instead, you could use the Visible propert for a similar effect.
If they are ScreenGuis, then the problem may be with whoever is changing the Enabled properties. Are you sure the properties are actually being changed?
A little bit off topic, but won’t you think ATLUS would be mad if they found a roblox copy of their game? I mean, do whatever, but I would be a little mad. Would love to see something similar though.
It’s not a Persona remake or anything, it’s a fighting game a la battlegrounds games. I don’t know how much of a problem they may have with that, if they ever even found out, but I’ll be willing to comply if I have to, I guess.
Sincere Apologies, I just locked onto velvet room, and thought it was something from persona. But shouldn’t be an issue if you remake 1 element with a little changes. Anyway, your code doesn’t seem wrong, but additional debugging is probably going to be needed:
local pGui = game.Players.LocalPlayer.PlayerGui
function makeVisible(enabled)
print("happening")
if enabled then
script.Parent.Enabled = false
else
script.Parent.Enabled = true
end
end
print("velvetRoomUI children:", pGui.velvetRoomUI:GetChildren())
print("fortuneTellerUI exists:", pGui:FindFirstChild("fortuneTellerUI") ~= nil)
print("mainUI exists:", pGui.fortuneTellerUI and pGui.fortuneTellerUI:FindFirstChild("mainUI") ~= nil)
local fortuneUI = pGui.fortuneTellerUI.mainUI
local velvetUI = pGui.velvetRoomUI
fortuneUI:GetPropertyChangedSignal("Enabled"):Connect(function()
print("Fortune UI Enabled changed to:", fortuneUI.Enabled)
makeVisible(fortuneUI.Enabled)
end)
velvetUI:GetPropertyChangedSignal("Enabled"):Connect(function()
print("Velvet UI Enabled changed to:", velvetUI.Enabled)
makeVisible(velvetUI.Enabled)
end)
Get back to me, if you can’t fix the anomaly, you might also want to try a .Changed event for Property Change Detection.
As others have said, GetPropertyChangedSignal doesn’t provide the new value as a parameter(although it probably should).
Just change the function to this:
function makeVisible()
print("happening")
script.Parent.Visible = not pGui.fortuneTellerUI.Enabled and not pGui.velvetRoomUI.Enabled
end
Going off your original code this should achieve precisely what you want: making the frame visible only when both of the two ScreenGuis are not enabled, and invisible if either one of them are visible.