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

How do I get rid of my menu GUI frame when the player clicks the play button?

Asked by 3 years ago

So, I made a menu for my game when a player loads in they'll click the Play button to return their camera to their character, but the GUI won't go away. I have the scripts

Start GUI CameraGui Frame Camera PlayBtn Script.

The Camera Script is

local Player = game.Players.LocalPlayer local Character = Player.Character or Player.CharacterAdded:Wait() local Camera = workspace.CurrentCamera

local PlayButton = script.Parent.PlayBtn

repeat wait() Camera.CameraType = Enum.CameraType.Scriptable until Camera.CameraType == Enum.CameraType.Scriptable Camera.CFrame = workspace.CameraFocus.CFrame

PlayButton.MouseButton1Click:Connect(function() Camera.CameraType = Enum.CameraType.Custom PlayButton:Destroy() end)

The PlayBtn Script is

local player = game:GetService("Players") local frame = game.StarterGui.CameraGui.Frame local PlayBTN = script.Parent

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

I've watched many tutorials on this, but the Gui is still there and won't go away. I've tried mulitple things and they don't seem to work. No clue what I'm doing wrong, I'm very new scripting and could use some help with this!

1 answer

Log in to vote
0
Answered by 3 years ago

Instead of going from the Player Gui you can go directly from the Starter Gui and destroying isn't the best for GUIs because if it was ran on a SS script it would function when ANY player pressed the button

Ad

Answer this question