--[[
local obj = --object or gui or wahtever goes here
local Properties = {}
Properties.Size = UDim2.new()
Tween(obj,Properties,2,true,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false)
--Obj,Property,Time,wait,Easingstyle,EasingDirection,RepeatAmt,Reverse
]]


hum.Seated:connect(function(IsSeated,seat)
	if IsSeated and seat then
		local piano = seat.Parent.Parent
		local amt = 0
		camparts = {}
		for i,v in pairs(piano.Keys:GetChildren()) do
			if v and v:IsA("Part") and string.match(v.Name,"Camera") then
				if string.match(v.Name,"%d") then
					if string.match(v.Name,"2") then
						table.insert(camparts,2,v)
					elseif string.match(v.Name,"3") then
						table.insert(camparts,3,v)
					elseif string.match(v.Name,"4") then
						table.insert(camparts,4,v)
					elseif string.match(v.Name,"5") then
						table.insert(camparts,5,v)
					end
				else
					table.insert(camparts,1,v)
				end
				amt = amt + 1
			end
		end
		if amt > 1 then
			cam.CameraType = Enum.CameraType.Scriptable
			for i = 1,amt do
				gui.Frame["Cam"..i].Visible = true
			end
			gui.Frame.Cam1.BackgroundColor3 = selected
		end
	elseif not IsSeated then
		for i,v in pairs(gui.Frame:GetChildren()) do
			v.Visible = false
			v.BackgroundColor3 = idle
			cam.CameraType = Enum.CameraType.Custom
		end
	end
	wait(.1)
end)

plr.CharacterAdded:Connect(function(char)
	if char.Name == plr.Name then
		repeat hum = char:WaitForChild("Humanoid") wait() until hum
		hum.Seated:connect(function(IsSeated,seat)
			if IsSeated and seat then
				local piano = seat.Parent.Parent
				local amt = 0
				camparts = {}
				for i,v in pairs(piano.Keys:GetChildren()) do
					if v and v:IsA("Part") and string.match(v.Name,"Camera") then
						if string.match(v.Name,"%d") then
							if string.match(v.Name,"2") then
								table.insert(camparts,2,v)
							elseif string.match(v.Name,"3") then
								table.insert(camparts,3,v)
							elseif string.match(v.Name,"4") then
								table.insert(camparts,4,v)
							elseif string.match(v.Name,"5") then
								table.insert(camparts,5,v)
							end
						else
							table.insert(camparts,1,v)
						end
						amt = amt + 1
					end
				end
				if amt > 1 then
					cam.CameraType = Enum.CameraType.Scriptable
					for i = 1,amt do
						gui.Frame["Cam"..i].Visible = true
					end
					gui.Frame.Cam1.BackgroundColor3 = selected
				end
			elseif not IsSeated then
				for i,v in pairs(gui.Frame:GetChildren()) do
					v.Visible = false
					v.BackgroundColor3 = idle
					cam.CameraType = Enum.CameraType.Custom
				end
			end
			wait(.1)
		end)
		wait()
	end
end)

for i,v in pairs(gui.Frame:GetChildren()) do
	if v then
		v.MouseButton1Click:connect(function()
			if v.Visible then
				for a,b in pairs(gui.Frame:GetChildren()) do
					b.BackgroundColor3 = idle
				end
				local RealCam
				for a,b in pairs(guicams) do
					if b == v then
						RealCam = camparts[a]
					end
				end
				cam:Interpolate(RealCam.CFrame * CFrame.new(0, 0, 1),RealCam.CFrame,.5)
				v.BackgroundColor3 = selected
			end
		end)
	end
end
