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

Would this work?

Asked by 10 years ago
for k,v in pairs(game.Players:GetPlayers())
    v:Players.Character.Torso.BodyVelocity.maxForce.Vector3.new(0, 15000, 0)
game.Players.Character.Torso.BodyPosition.Vector3.new(0, 5, 0)
         end
end

Would this code make me hover at a constant height of 5 studs, even when off of a platform? If not, how would I go about fixing it so that its ONLY me hovering?

0
I'm asking this question because I'm VERY inexperienced with BodyVelocity and BodyPosition. MUSHR0OM 0 — 10y

1 answer

Log in to vote
1
Answered by
Maxomega3 106
10 years ago

Hey, Mushr0om :D

It would not work for a couple of reasons:

*Character is not a valid member of Players, it's a valid member of A player. *That is not how you index v in an in pairs for loop *You forgot "do" in your for loop

Here's a revised version:

for k,v in pairs (game.Players:GetPlayers ()) do 
    v.Character.Torso.BodyVelocity.maxForce = Vector3.new (0,15000,0) -- how to define a value
    v.Character.Torso.BodyPosition = Vector3.new (0,5,0) -- something seems missing on this line
end -- only need one end

This may not work because of line 4. It seems there's a value inside BodyPosition to do it, but I'm not an expert on BodyObjects either, so I wouldn't know it.

0
How would I do it for only MY character? MUSHR0OM 0 — 10y
0
Even simpler. Workspace.MUSHR0OM.Torso.BodyVelocity.maxForce = Vector3.new (0,15000,0) Workspace.MUSHR0OM.Torso.BodyPosition = Vector3.new (0,5,0) Maxomega3 106 — 10y
Ad

Answer this question