How to make the player attracted to the sky instead of the ground?

What I’m trying to make is a system where a person can instead of standing on the ground entirely reverse their character 180 degrees and begin falling into the sky until hitting the roof.

What I have:


What I want to achieve:

Basically like the Minecraft gravity mod, but it only works for the ground and the sky.

Any help is appreciated.

2 Likes

This maybe help?

I’ll try to play with the source code too achieve something, thanks for the help.

The easiest way to do it is hook the character added event and add a VectorForce to the character that pulls the player up. This is basically the same thing as making things float, except that you double the force needed to counteract gravity.

-- Allows the projectile to float.
local function effectFloat(part, floatData)
	-- New Attachment
	local attach = Instance.new("Attachment")

	-- Attachment Parameters
	attach.Name = "ProjAttach"
	attach.Position = Vector3.new(0, 0, 0)
	attach.Parent = part

	-- New VectorForce
	local force = Instance.new("VectorForce")

	-- VectorForce Parameters.
	force.Force = Vector3.new(0, part:GetMass() * workspace.Gravity, 0)
	force.ApplyAtCenterOfMass = true
	force.RelativeTo = Enum.ActuatorRelativeTo.World
	force.Attachment0 = attach
	force.Parent = part
end

So instead of having part:GetMass() * workspace.Gravity for the Y component, use part.AssemblyMass * workspace.Gravity * 2 instead. Since a player character is an assembly, you need to get the total mass of the assembly. Tools also have mass, so if the player equips a tool, you will have to account for that as well. The code above was designed to make projectiles float (rockets and such) but it can be easily modified for other purposes.

Sheesh, thanks man. I already have a script for reversing the animation, so this is perfect.