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

How do I change MaxForce in BodyPosition with a script?

Asked by 6 years ago

I have been trying to change a property for BodyPosition called MaxForce, using multiple methods and I thought it would be simple but it's not working. I looked at the context help in Studio and found out it was a Vector3 value, So I thought it would lead me on to what I needed to do but it still hasn't worked.

for i= 0,1,1 do
game.Workspace.SpeedBoat.BoatControl.BodyPosition.MaxForce = Vector3.new(0,500000,0)
end

Like I said, I thought this would all I need to change a property in a BodyPosition, but I was mistaken.

1 answer

Log in to vote
0
Answered by
T0XN 276 Moderation Voter
6 years ago
Edited 6 years ago

First of all, in advance please excuse my OCD, but I'm not sure why you have a for loop that doesn't affect the code. Also it's quite pointless that you put the following:

for i = 0, 1, 1 do
    --stuff
end

The result is the same if you write this:

for i = 0, 2 do
    --stuff
end

Second, I'm not sure if you already know this (if you do, then my bad) but the MaxForce acts as the capping, or rather self-explanatory maximum force of the BodyPosition. Make sure the 'P' (power) value of the BodyPosition is not 0 as this is the value that actually gives the BodyPosition its force.

Try changing your script to something along the lines of this:

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function()
        game.Workspace.SpeedBoat.BoatControl.BodyPosition = Vector3.new(0, 500000, 0)
    end)
end)

It would be helpful if you could tell me if there are any errors that appear in the studio's console.

If there is something that you are still unclear with I hope this wiki page can help you out:

http://wiki.roblox.com/index.php?title=API:Class/BodyPosition

0
Thanks for the criticism I suppose, but the problem is the script I have is not able to change the MaxForce, or P and D, either. GlobeHousee 50 — 6y
0
Yeah. I seen many people do "for i = 1, 1 do end". I'm just like, WHY, WHY ARE YOU MAKING A LOOP FOR THIS??? hiimgoodpack 2009 — 6y
Ad

Answer this question