function Receive(a,n,...)local t={...}if a==User and n=="\112\108\097\121"then Connector:FireAllClients("\112\108\097\121",User,t[1],Settings.SoundSource.Position,Settings.PianoSoundRange,Settings.PianoSounds,t[2],Settings.IsCustom)HighlightPianoKey(t[1]>61 and 61 or t[1]<1 and 1 or t[1],t[3])elseif a==User and n=="\097\098\111\114\116"then Deactivate()if SeatWeld then SeatWeld:remove()end end end function Activate(a)Connector:FireClient(a,"\097\099\116\105\118\097\116\101",Settings.CameraCFrame,Settings.PianoSounds,true)User=a for a,n in pairs(Piano.Keys.Keys:GetChildren())do local t=n local H={}H.Transparency=0 Tween(t,H,1,false,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false)end end function Deactivate()if User and User.Parent then Connector:FireClient(User,"\100\101\097\099\116\105\118\097\116\101")User.Character:SetPrimaryPartCFrame(Box.CFrame+Vector3.new(0,5,0))end for a,n in pairs(Piano.Keys.Keys:GetChildren())do local t=n local H={}H.Transparency=1 Tween(t,H,1,false,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false)end User=nil end
----------------------------------
------------FUNCTIONS-------------
----------------------------------

function Receive(player, action, ...)
	local args = { ... }
	if player == User and action == "play" then
		Connector:FireAllClients(
			"play",
			User,
			args[1],
			Settings.SoundSource.Position,
			Settings.PianoSoundRange,
			Settings.PianoSounds,
			args[2],
			Settings.IsCustom
		)
		HighlightPianoKey((args[1] > 61 and 61) or (args[1] < 1 and 1) or args[1], args[3])
	elseif player == User and action == "abort" then
		Deactivate()
		if SeatWeld then
			SeatWeld:remove()
		end
	end
end

function Activate(player)
	Connector:FireClient(player, "activate", Settings.CameraCFrame, Settings.PianoSounds, true)
	User = player
	for i, v in pairs(Piano.Keys.Keys:GetChildren()) do
		local obj = v
		local Properties = {}
		Properties.Transparency = 0
		Tween(obj, Properties, 1, false, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false)
	end
end

function Deactivate()
	if User and User.Parent then
		Connector:FireClient(User, "deactivate")
		User.Character:SetPrimaryPartCFrame(Box.CFrame + Vector3.new(0, 5, 0))
	end
	for i, v in pairs(Piano.Keys.Keys:GetChildren()) do
		local obj = v
		local Properties = {}
		Properties.Transparency = 1
		Tween(obj, Properties, 1, false, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false)
	end
	User = nil
end
