Hello, I have a problem. I want to use a cutscene, but I want that you cant see other Guis until you press the play button. How can I make a button that enables all guis if pressed?
You can make a loop and get all the descendants of the game which are a ScreenGUI.
script.Parent.MouseButton1Click:Connect(function()
gui.Enabled = true
gui2.Enabled = true
end)
Insert there your guis, and insert this code under the Button, you also can use a loop.
local PlayerGUI = game.Players.LocalPlayer.PlayerGui
script.Parent.Enabled:Connect(function()
for i, v in pairs(PlayerGUI:GetChildren()) do
if v:IsA("ScreenGui") then
v.Enabled = true
end
end
end)
This is an easy way to do it, make sure it’s a local script.
do I put it into the play button?
Yes, you do. It should enable all ScreenGUIs.
I have put it in but it does nothing, or is it because I’m using a image button?
That shouldn’t be a factor. Does anything error in the output?
I fixed it with this script
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Parent.Parent.HealthBarGui.Enabled = true
script.Parent.Parent.Parent.Parent.MessageGUI.Enabled = true
script.Parent.Parent.Parent.Parent.TeamGUI.Enabled = true
script.Parent.Parent.Parent.Parent.MoneyGUI.Enabled = true
end)
Make sure your code is in a LocalScript
or else this won’t work
local guiList = {} -- write the location of the guis you want to hide from the player in here
-- Example: {game.Players.LocalPlayer.PlayerGui.Frame1, game.Players.LocalPlayer.PlayerGui.MenuFrame}
for i, v in pairs do -- this will look at all items in the table
v.Visible = false -- this will make all items in the table invisible
end
wait(5) -- set this to how long your cutscene takes
for i, v in pairs do -- this will look at all items in the table
v.Visible = true -- this will make all items in the table visible
end