trying to have it lift things up when I click on the on button and off when clicked off? REALLY NEW TO SCRIPTING):
✓ ANSWER ACCEPTED
How would i make a bodyforce have a on/off switch(onclick)?
1 answer
✓ Accepted answer
Well, considering that it doesn't have an enabled option I would recommend doing this
local OffButton = script.Parent; --Variable to reference the button
local partWithForce = game.Workspace.WhereEverItIs; --Replace with where you part actually is
OffButton.ClickDetector.MouseClick:connect(function()
partWithForce.BodyForce.force = Vector3.new(0,0,0); --This will turn the force off
end)
And if you want to turn it back on
local OnButton = script.Parent; --Wherever your actual button is
local partWithForce = game.Workspace.WhereEverItIs;
OnButton.ClickDetector.MouseClick:connect(function()
local force = Vector3.new(PUT, NUMBERS, HERE); --Replace with your force
partWithForce.BodyForce.force = force--This will turn the force back on
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

13 comments
my bodyforce brick is called up and the on and off buttons are just 1 and 2 so yeaa if that helps
In order for a script to do something to anything, if has to know WHAT to work on. If I put a brick inside my workspace called "Hello", than the only way I could make a script do something to it would be game.Workspace.Hello Does that make sense?
The local variable called "partWithForce" has to have an actual brick associated with it. If i wanted to use my hello brick because the body force was inside it, I would say local partWithForce = game.Workspace.Hello
Yup
alrigh i have that and nothing
you do the script and see if it work for you
Alright, I see what I did wrong. I was trying to edit the force by saying partWithForce.BodyForce but I needed to add .force to the end of that
Remember, the BodyForce requires ridiculously huge numbers to do stuff.
yeaaa i got 1575 in there
alright got it but im gonna need it to be grouped
never mind man i gt it thanks for te help
No problem! Can you accept my answer if it helped you?
ohh yaa