local Player = game.Players.LocalPlayer
local Character = Player.Character
local MainFrame = script.Parent
local Camera = workspace.CurrentCamera
local Humanoid = Character:WaitForChild("Humanoid")
local Mouse = Player:GetMouse()
local RunService = game:GetService("RunService")
local MaxDegree = math.rad(80)

local currentCam = 0
local connection

local function updateAccessoryTransparency(target, isTransparent)
	for _, child in target:GetChildren() do
		if child:IsA("Accessory") then
			updateAccessoryTransparency(child, isTransparent)
		elseif child:IsA("BasePart") then
			local hasRelevantAttachment = child:FindFirstChild("HatAttachment") or
				child:FindFirstChild("FaceCenterAttachment") or
				child:FindFirstChild("FaceFrontAttachment") or
				child:FindFirstChild("FaceRearAttachment") or
				child:FindFirstChild("HairAttachment") or
				child:FindFirstChild("NeckAttachment") or
				child:FindFirstChild("WaistFrontAttachment")

			if hasRelevantAttachment --[[and child.Name ~= "Torso"]] then
				child.LocalTransparencyModifier = isTransparent and 1 or child.Transparency
			end
		end
	end
end

local Exceptions = {
	FP = function()
		if currentCam == 0 then
			currentCam += 1
			Camera.FieldOfView = 70
			Camera.CameraSubject = Character:FindFirstChild("Head")
			updateAccessoryTransparency(Character)
		elseif currentCam == 1 then
			currentCam += 1
			updateAccessoryTransparency(Character, true)
			Camera.FieldOfView = 90
			connection = RunService.RenderStepped:Connect(function()
				local mousePos = Vector2.new(Mouse.X, Mouse.Y)
				local screenCenter = Camera.ViewportSize / 2
				local delta = mousePos - screenCenter

				local angle = Vector2.new((delta.Y / screenCenter.Y) * MaxDegree, (delta.X / screenCenter.X) * MaxDegree)
				Camera.CFrame = Character.Head.CFrame * CFrame.new(0, 0, (-Character.Head.Size.Z / 2) * 1.25) * CFrame.Angles(-angle.X, -angle.Y, 0)
			end)
		elseif currentCam == 2 then
			connection:Disconnect()
			updateAccessoryTransparency(Character)
			currentCam = 0
			Camera.FieldOfView = 70
			Camera.CameraSubject = Humanoid
		end
	end,
	ExcludedFrame2 = function()
		-- temp
	end,
}

local function hideFrames(targetFrame)
	local framesToHide = {"Morph", "Animation", "Walkspeed", "House"}
	for _, frameName in ipairs(framesToHide) do
		if frameName ~= targetFrame then
			local frame = MainFrame.Parent:FindFirstChild(frameName)
			if frame and frame:IsA("Frame") then
				frame.Visible = false
			end
		end
	end
end

local function onButtonClick(button)
	if Exceptions[button.Name] then
		Exceptions[button.Name]()
	else
		local targetFrame = MainFrame.Parent:FindFirstChild(button.Name)
		if targetFrame and targetFrame:IsA("Frame") then
			if not targetFrame.Visible then
				targetFrame.Visible = true
				if button.Name == "Morph" or button.Name == "Animation" or button.Name == "Walkspeed" or button.Name == "House" then
					hideFrames(button.Name)
				end
			else
				targetFrame.Visible = false
			end
		else
			warn("Frame named '" .. button.Name .. "' not found.")
		end
	end
end

for _, child in MainFrame:GetChildren() do
	if child:IsA("TextButton") then
		child.MouseButton1Click:Connect(function()
			onButtonClick(child)
		end)
	end
end


i want to print something when the player puts the mouse on one of the buttons parented to MainFrame, and then print when the mouse gets off the button. print something when the player clicks and print something when the player releases.