Buttons not working

Hello, so i got a problem where the buttons are not working the script is a local script and is in starter gui and there are errors
image

local Frame = game.Workspace.ui.SurfaceGui.HS.ScrollingFrame.ExitButton10
Frame.MouseButton1Click:Connect(function()
	Frame.Visible = false
end)

image
how ever these back buttons and exit buttons have stoped working after i have done that
image
script for the button the buttons are inside the workspace
image

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

Try this:
local playerUI = game.Players.LocalPlayer.PlayerGui
local Frame = playerUI.ui.SurfaceGui.HS.ScrollingFrame:WaitForChild(“ExitButton10”)

Can you try changing the script from a serverscript to a localscript?

if i change it from server to local script the buttons quit working

Where is the button located? Is it on the SurfaceGui or in a ScreenGui inside of StarterGui?

the buttons are located in the surface gui

Use WaitForChild. It’s often needed in GUIs.