r=game:service("\082\117\110\083\101\114\118\105\099\101")Tool=script.Parent local y=196.66666666667 local m=.75 local R=nil local W=nil local p=nil local g=nil function recursiveGetLift(R)local W=0 for R,p in pairs(R:GetChildren())do if p:IsA("\066\097\115\101\080\097\114\116")then W=W+(p:GetMass()*y)*m end W=W+recursiveGetLift(p)end return W end function onMassChanged(y,m)print("\077\097\115\115 \099\104\097\110\103\101\100\058"..(y.Name..("    "..m.Name)))if R~=nil then R.force=Vector3.new(0,recursiveGetLift(m),0)end end function UpdateGhostState(y)if y==true then R:Remove()R=nil W:disconnect()p:disconnect()else if R==nil then local y=Tool.Parent if y==nil then return end R=Instance.new("\066\111\100\121\070\111\114\099\101")R.Name="\071\114\097\118\105\116\121\067\111\105\108\069\102\102\101\099\116"R.force=Vector3.new(0,recursiveGetLift(y),0)R.Parent=y.Head ghostChar=y W=y.ChildAdded:connect(function(m)onMassChanged(m,y)end)p=y.ChildRemoved:connect(function(m)onMassChanged(m,y)end)end end end function onEquipped()Tool.Handle.CoilSound:Play()UpdateGhostState(false)end function onUnequipped()UpdateGhostState(true)end script.Parent.Equipped:connect(onEquipped)script.Parent.Unequipped:connect(onUnequipped)
-------- OMG HAX

r = game:service("RunService")

Tool = script.Parent

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

local ghostEffect = nil
local massCon1 = nil
local massCon2 = nil

local head = nil
function recursiveGetLift(root)
	local force = 0

	for _, obj in pairs(root:GetChildren()) do
		if obj:IsA("BasePart") then
			force = force + obj:GetMass() * equalizingForce * gravity
		end
		force = force + recursiveGetLift(obj)
	end

	return force
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()
	Tool.Handle.CoilSound:Play()
	UpdateGhostState(false)
end

function onUnequipped()
	UpdateGhostState(true)
end

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