What is the issue?
Now, someone tried helping me (thank you) but I kept getting errors. I fixed them, but the thing that I want to work doesn’t work, here’s the script:
local Player = game:GetService(“Players”).LocalPlayer
local PlayerGui = Player.PlayerGui
local TextButton = PlayerGui:WaitForChild(“ScreenGui”):WaitForChild(“BackButton”)
local CamButton = PlayerGui.ScreenGui:WaitForChild(“CameraButton”)
local MapGui = PlayerGui.ScreenGui:WaitForChild(“ImageButton”)
What do you want to achieve via this script, like what is it used for? Also try using the Lua format for scripts which is provided when you create a new thread.
local Player = game:GetService(“Players”).LocalPlayer
local PlayerGui = Player.PlayerGui
local TextButton = PlayerGui:WaitForChild(“ScreenGui”):WaitForChild(“BackButton”)
local CamButton = PlayerGui.ScreenGui:WaitForChild(“CameraButton”)
local MapGui = PlayerGui.ScreenGui:WaitForChild(“ImageButton”)
function TextButtonActivated()
CamButton.Visible = true
TextButton.Visible = false
MapGui.Visible = false
end
function CamButtonActivated()
CamButton.Visible = false
TextButton.Visible = true
MapGui.Visible = true
end
TextButton.MouseButton1Click:Connect(TextButtonActivated())
CamButton.MouseButton1Click:Connect(CamButtonActivated())
From what I could see you made a few syntactical errors.
It seems like the local script you are using is in the screenGUI in question. This means you could simplify your script somewhat. Other than that which line does the error direct you to when you click on it?
local ScreenGUI = script.Parent
local TextButton = ScreenGUI:WaitForChild("BackButton")
local CamButton = ScreenGUI:WaitForChild("CameraButton")
local MapGui = ScreenGUI:WaitForChild("ImageButton")
local function TextButtonActivated()
CamButton.Visible = true
TextButton.Visible = false
MapGui.Visible = false
end
local function CamButtonActivated()
CamButton.Visible = false
TextButton.Visible = true
MapGui.Visible = true
end
TextButton.MouseButton1Click:Connect(TextButtonActivated())
CamButton.MouseButton1Click:Connect(CamButtonActivated())