Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do I make my character float?

Asked by
phriol 25
9 years ago

I've tried making my character float, but it didn't work. This is what i've tried.

local limbs = {"Right Arm", "Left Arm", "Right Leg", "Left Leg", "Torso", "Head"}
local pl = Workspace:FindFirstChild("phriol")
if pl then
    for _, v in ipairs(limbs) do
        local limb = pl:FindFirstChild(v)
        if limb then
            repeat
                wait()
                Workspace.phriol.Humanoid.Animator:remove()
                wait()
                limb.Position = limb.Position + Vector3.new(0, 0.5, 0)
            until false
        end
    end
end

1 answer

Log in to vote
2
Answered by 9 years ago

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.

0
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. EzraNehemiah_TF2 3552 — 9y
0
@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 alphawolvess 1784 — 9y
Ad

Answer this question