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

How Do I Enable A Frame By Clicking A Button In A Different GUI?

Asked by 3 years ago

Im trying to make it so if you press a button (SkipCutscene), it enables a frame with a team selecting button.

I made this script which works when i put it in the TeamGui folder

local tgui = script.Parent.Parent.Parent:WaitForChild("TeamGui")
local toggle = tgui:WaitForChild("Toggle")

script.Parent.MouseButton1Click:Connect(function(player)
    toggle.Visible = true

end)

This script works just fine when put in one of the "TeamGui" buttons, but when i put it into the "Cutscene" GUI it just doesn't work.

https://gyazo.com/45b6ba5017a73e526f6edca7ccd92873

Is there a way to enable the frame called "Toggle" (in the TeamGui) by clicking the "SkipCutscene" button in the "Cutscene" GUI?

0
There is no "Mousebutton1click" event for ViewPort Frames, Search for events of ViewPort Frame in Object Browser cristianrafa123 -7 — 3y
0
You can change the GUI by going back to the parent of your current GUI cristianrafa123 -7 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

Okay i figured it out. I used a cutscene plugin, so the Skip button is controlled by a completely different script in the StarterPlayerScripts folder. I went into the main script and located the TeamGui and the button i wanted to make visible;

local toggle = game:GetService("Players").LocalPlayer:WaitForChild('PlayerGui'):WaitForChild("TeamGui"):WaitForChild("Toggle")

Then there was a line that actually controlled the skip button so i added the "toggle.Visible = true"

    if SkipCutsceneButton and SkipCutsceneButton:IsA("GuiButton") then
        SkipCutsceneButton.MouseButton1Click:Connect(function()         

            toggle.Visible = true

            Demo:Stop()
        end)
    end
Ad

Answer this question