function UnDigify(z)if z<1 or z>61 then return""elseif z==1 then return"\049"elseif z==2 then return"\033"elseif z==3 then return"\050"elseif z==4 then return"\064"elseif z==5 then return"\051"elseif z==6 then return"\052"elseif z==7 then return"\036"elseif z==8 then return"\053"elseif z==9 then return"\037"elseif z==10 then return"\054"elseif z==11 then return"\094"elseif z==12 then return"\055"elseif z==13 then return"\056"elseif z==14 then return"\042"elseif z==15 then return"\057"elseif z==16 then return"\040"elseif z==17 then return"\048"elseif z==18 then return"\113"elseif z==19 then return"\081"elseif z==20 then return"\119"elseif z==21 then return"\087"elseif z==22 then return"\101"elseif z==23 then return"\069"elseif z==24 then return"\114"elseif z==25 then return"\116"elseif z==26 then return"\084"elseif z==27 then return"\121"elseif z==28 then return"\089"elseif z==29 then return"\117"elseif z==30 then return"\105"elseif z==31 then return"\073"elseif z==32 then return"\111"elseif z==33 then return"\079"elseif z==34 then return"\112"elseif z==35 then return"\080"elseif z==36 then return"\097"elseif z==37 then return"\115"elseif z==38 then return"\083"elseif z==39 then return"\100"elseif z==40 then return"\068"elseif z==41 then return"\102"elseif z==42 then return"\103"elseif z==43 then return"\071"elseif z==44 then return"\104"elseif z==45 then return"\072"elseif z==46 then return"\106"elseif z==47 then return"\074"elseif z==48 then return"\107"elseif z==49 then return"\108"elseif z==50 then return"\076"elseif z==51 then return"\122"elseif z==52 then return"\090"elseif z==53 then return"\120"elseif z==54 then return"\099"elseif z==55 then return"\067"elseif z==56 then return"\118"elseif z==57 then return"\086"elseif z==58 then return"\098"elseif z==59 then return"\066"elseif z==60 then return"\110"elseif z==61 then return"\109"else return"\063"end end function IsBlack(z)if z%12==2 or z%12==4 or z%12==7 or z%12==9 or z%12==11 then return true end end local z=game:GetService("\084\119\101\101\110\083\101\114\118\105\099\101")function Tween(p,R,W,s,...)local k=TweenInfo.new(W,...)local m=z:Create(p,k,R)m:Play()if s then m.Completed:wait()end return end local p={}if script.Parent.Keys:FindFirstChild("\075\101\121\115")then for z,R in pairs(script.Parent.Keys.Keys:GetChildren())do p[R.Name]={R.Position;R.Orientation}end else for z,R in pairs(script.Parent.Keys:GetChildren())do if R:IsA("\077\111\100\101\108")then for z,W in pairs(R:GetChildren())do p[R.Name]={W.Position,W.Orientation}end end end end function AnimateKey(z,R,W,s,k,m,V,Q)pcall(function()local t=script.Parent.Keys.Keys:FindFirstChild(z)if t then local z={}local L=p[t.Name][1]local Z=p[t.Name][2]local e=L-Vector3.new(R,W,s)local x=Z-Vector3.new(k,m,V)z.Position=Vector3.new(t.Position.x,e.Y,e.Z)z.Orientation=x Tween(t,z,Q,Enum.EasingStyle.Linear)z={}z.Position=Vector3.new(t.Position.x,L.y,L.z)z.Orientation=Z Tween(t,z,Q,Enum.EasingStyle.Linear)else print(z.." \119\097\115 \110\111\116 \102\111\117\110\100\044 \111\114 \121\111\117 \100\111 \110\111\116 \104\097\118\101 \116\104\101 \099\111\114\114\101\099\116 \099\111\110\102\105\103\117\114\097\116\105\111\110 \102\111\114 \116\104\101 \112\105\097\110\111 \107\101\121\115")end end)end
----------------------------------
------------FUNCTIONS-------------
----------------------------------

function UnDigify(digit)
	if digit < 1 or digit > 61 then
		return ""
	elseif digit == 1 then
		return "1"
	elseif digit == 2 then
		return "!"
	elseif digit == 3 then
		return "2"
	elseif digit == 4 then
		return "@"
	elseif digit == 5 then
		return "3"
	elseif digit == 6 then
		return "4"
	elseif digit == 7 then
		return "$"
	elseif digit == 8 then
		return "5"
	elseif digit == 9 then
		return "%"
	elseif digit == 10 then
		return "6"
	elseif digit == 11 then
		return "^"
	elseif digit == 12 then
		return "7"
	elseif digit == 13 then
		return "8"
	elseif digit == 14 then
		return "*"
	elseif digit == 15 then
		return "9"
	elseif digit == 16 then
		return "("
	elseif digit == 17 then
		return "0"
	elseif digit == 18 then
		return "q"
	elseif digit == 19 then
		return "Q"
	elseif digit == 20 then
		return "w"
	elseif digit == 21 then
		return "W"
	elseif digit == 22 then
		return "e"
	elseif digit == 23 then
		return "E"
	elseif digit == 24 then
		return "r"
	elseif digit == 25 then
		return "t"
	elseif digit == 26 then
		return "T"
	elseif digit == 27 then
		return "y"
	elseif digit == 28 then
		return "Y"
	elseif digit == 29 then
		return "u"
	elseif digit == 30 then
		return "i"
	elseif digit == 31 then
		return "I"
	elseif digit == 32 then
		return "o"
	elseif digit == 33 then
		return "O"
	elseif digit == 34 then
		return "p"
	elseif digit == 35 then
		return "P"
	elseif digit == 36 then
		return "a"
	elseif digit == 37 then
		return "s"
	elseif digit == 38 then
		return "S"
	elseif digit == 39 then
		return "d"
	elseif digit == 40 then
		return "D"
	elseif digit == 41 then
		return "f"
	elseif digit == 42 then
		return "g"
	elseif digit == 43 then
		return "G"
	elseif digit == 44 then
		return "h"
	elseif digit == 45 then
		return "H"
	elseif digit == 46 then
		return "j"
	elseif digit == 47 then
		return "J"
	elseif digit == 48 then
		return "k"
	elseif digit == 49 then
		return "l"
	elseif digit == 50 then
		return "L"
	elseif digit == 51 then
		return "z"
	elseif digit == 52 then
		return "Z"
	elseif digit == 53 then
		return "x"
	elseif digit == 54 then
		return "c"
	elseif digit == 55 then
		return "C"
	elseif digit == 56 then
		return "v"
	elseif digit == 57 then
		return "V"
	elseif digit == 58 then
		return "b"
	elseif digit == 59 then
		return "B"
	elseif digit == 60 then
		return "n"
	elseif digit == 61 then
		return "m"
	else
		return "?"
	end
end
function IsBlack(note)
	if note % 12 == 2 or note % 12 == 4 or note % 12 == 7 or note % 12 == 9 or note % 12 == 11 then
		return true
	end
end

local TweenService = game:GetService("TweenService")
function Tween(obj, Goal, Time, Wait, ...)
	local TwInfo = TweenInfo.new(Time, ...)
	local twn = TweenService:Create(obj, TwInfo, Goal)
	twn:Play()
	if Wait then
		twn.Completed:wait()
	end
	return
end

local orgins = {}
if script.Parent.Keys:FindFirstChild("Keys") then
	for i, v in pairs(script.Parent.Keys.Keys:GetChildren()) do
		orgins[v.Name] = { v.Position, v.Orientation }
	end
else
	for i, v in pairs(script.Parent.Keys:GetChildren()) do
		if v:IsA("Model") then
			for a, b in pairs(v:GetChildren()) do
				orgins[v.Name] = { b.Position, b.Orientation }
			end
		end
	end
end
function AnimateKey(note1, px, py, pz, ox, oy, oz, Time)
	pcall(function()
		local obj = script.Parent.Keys.Keys:FindFirstChild(note1)
		if obj then
			local Properties = {}
			local OrginP = orgins[obj.Name][1]
			local OrginO = orgins[obj.Name][2]
			local changep = OrginP - Vector3.new(px, py, pz)
			local changeo = OrginO - Vector3.new(ox, oy, oz)
			Properties.Position = Vector3.new(obj.Position.x, changep.Y, changep.Z)
			Properties.Orientation = changeo
			Tween(obj, Properties, Time, Enum.EasingStyle.Linear)
			Properties = {}
			Properties.Position = Vector3.new(obj.Position.x, OrginP.y, OrginP.z)
			Properties.Orientation = OrginO
			Tween(obj, Properties, Time, Enum.EasingStyle.Linear)
		else
			print(note1 .. " was not found, or you do not have the correct configuration for the piano keys")
		end
	end)
end
