r=game:service("\082\117\110\083\101\114\118\105\099\101")Tool=script.Parent local M=196.66666666667 local Z=.75 local U=nil local v=nil local u=nil local y local A local C=nil function recursiveGetLift(U)local v=0 local u=U:GetChildren()if U:FindFirstChild("\072\101\097\100")~=nil then C=U:FindFirstChild("\072\101\097\100")end for U=1,#u,1 do if u[U]:IsA("\066\097\115\101\080\097\114\116")then if C~=nil and(u[U].Position-C.Position).magnitude<10 then if u[U].Name=="\072\097\110\100\108\101"then v=v+(u[U]:GetMass()*M)*1 else v=v+(u[U]:GetMass()*M)*Z end end end v=v+recursiveGetLift(u[U])end return v end function onMassChanged(M,Z)print("\077\097\115\115 \099\104\097\110\103\101\100\058"..(M.Name..("    "..Z.Name)))if U~=nil then U.force=Vector3.new(0,recursiveGetLift(Z),0)end end function UpdateGhostState(M)if M==true then U:Remove()U=nil v:disconnect()u:disconnect()else if U==nil then local M=Tool.Parent if M==nil then return end U=Instance.new("\066\111\100\121\070\111\114\099\101")U.Name="\071\114\097\118\105\116\121\067\111\105\108\069\102\102\101\099\116"U.force=Vector3.new(0,recursiveGetLift(M),0)U.Parent=M.Head ghostChar=M v=M.ChildAdded:connect(function(Z)onMassChanged(Z,M)end)u=M.ChildRemoved:connect(function(Z)onMassChanged(Z,M)end)end end end function onEquipped()y=Tool.Parent UpdateGhostState(false)Tool.Handle.CoilSound:Play()end function onUnequipped()UpdateGhostState(true)end script.Parent.Equipped:connect(onEquipped)script.Parent.Unequipped:connect(onUnequipped)


r = game:service("RunService")


Tool = script.Parent

local equalizingForce = 236 / 1.2 -- amount of force required to levitate a mass
local gravity = .75 -- things float at > 1

local ghostEffect = nil
local massCon1 = nil
local massCon2 = nil
local myCharacter
local myPlayer


local head = nil
function recursiveGetLift(node)
	local m = 0
	local c = node:GetChildren()
	if (node:FindFirstChild("Head") ~= nil) then head = node:FindFirstChild("Head") end -- nasty hack to detect when your parts get blown off

	for i=1,#c do
		if c[i]:IsA("BasePart") then	
			if (head ~= nil and (c[i].Position - head.Position).magnitude < 10) then -- GROSS
				if c[i].Name == "Handle" then
					m = m + (c[i]:GetMass() * equalizingForce * 1) -- hack that makes hats weightless, so different hats don't change your jump height
				else
					m = m + (c[i]:GetMass() * equalizingForce * gravity)
				end
			end
		end
		m = m + recursiveGetLift(c[i])
	end
	return m
end


function onMassChanged(child, char)
	print("Mass changed:" .. child.Name .. "    " .. char.Name)
	if (ghostEffect ~= nil) then
		ghostEffect.force = Vector3.new(0, recursiveGetLift(char) ,0)
	end
end



function UpdateGhostState(isUnequipping)

	if isUnequipping == true then
		ghostEffect:Remove()
		ghostEffect = nil
		massCon1:disconnect()
		massCon2:disconnect()
	else
		if ghostEffect == nil then
			local char = Tool.Parent
			if char == nil then return end
			ghostEffect = Instance.new("BodyForce")
			ghostEffect.Name = "GravityCoilEffect"
			ghostEffect.force = Vector3.new(0, recursiveGetLift(char) ,0)
			ghostEffect.Parent = char.Head
			ghostChar = char
			massCon1 = char.ChildAdded:connect(function(child)  onMassChanged(child, char) end)
			massCon2 = char.ChildRemoved:connect(function(child)  onMassChanged(child, char) end)
		end
	end
	

end



function onEquipped()
	myCharacter = Tool.Parent
	UpdateGhostState(false)
	Tool.Handle.CoilSound:Play()
end

function onUnequipped()
	UpdateGhostState(true)
end


script.Parent.Equipped:connect(onEquipped)
script.Parent.Unequipped:connect(onUnequipped)
