One easy way to make your character "Float" is just the play an animation that has your character moved up a few studs.
You would need the ROBLOX animation plugin to create it, and the wiki has great information on how to make/use the animations.
However, if you literally want it to appear as if your player is not affected by gravity what so ever, you would want to use a BodyForce to counter the force of gravity on each part.
- How can we do this?
Easy, you would make the the value of force in the y axis the amount of force put on said parts. To do this you'd need to use
:GetMass()and multiply the mass of that part by the force of gravity (196.2).
Now, using it in your question, look bellow...
game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:connect(function(char)
local Parts = char:GetChildren()
for _,Content in pairs(Parts) do
if Content:IsA("Part") then
local Force = Instance.new("BodyForce", Content)
Force.force = Content:GetMass() * Vector3.new(0,196.2,0)
end
end
end)
end)
This will make you character float in the air because you've nullified the effects of gravity. Of course, most players wear hats, hats do have gravity which would cause the player to descend.
2 comments
The problem with the nano-gravity technique is when a outside force it applied, the momentum from the original force is making the part moving in that direction until it is stopped.
@LordDragonZord, I know. If you're canceling out gravity on your player and extra force is hit on your character, you'll be sent that direction until said force is gone. Yet he just asked for floating, I gave :P