of     1   

Penguine236
#60960325Wednesday, January 04, 2012 11:04 PM GMT

I'm trying to make an anti gravity kind of a thing using bodyforce, but i dont know how much force i need to make it anti gravity without shooting the player up into the air. Can someone tell me the amount of force or the formula for finding the correct amount of force.
TheNewScripter
#60960562Wednesday, January 04, 2012 11:07 PM GMT

Well, the formula is pretty simple. It uses a method that all BasePart's have, A.K.A. any part in ROBLOX, called 'GetMass'.     Workspace = Game:GetService("Workspace")     Part = Workspace.Part          Mass = Part:GetMass()     GravityOffset = 196.1 -- 196.1 is the rate at which a part falls in ROBLOX.          local BF = Instance.new("BodyForce", Part)     BF.force = Vector3.new(0, Mass * GravityOffset, 0) ×Dyslexic Scripter at Work×
Penguine236
#60960796Wednesday, January 04, 2012 11:10 PM GMT

Thx, but i have two question. "Workspace = Game:GetService("Workspace")" Why set that? There is already a constant called 'workspace' in roblox. Also, why do you always use GetService for things like players and workspace? just do game.Workspace or game.Players
TheNewScripter
#60961005Wednesday, January 04, 2012 11:12 PM GMT

Well, I used to use the pre-defined Workspace variable, but I didn't know exactly what it was set to, and when someone renamed Workspace a while back, the variable didn't work... Anyway, I use GetService because I have having to say 'game.Players' and 'game.asdfService' because anyone can re-name any service that isn't locked. And, I live at Script Builders, so people have a tendency to try and mess with things, such as services, so it became a forceful habit to use GetService. ×Dyslexic Scripter at Work×
TheNewScripter
#60961110Wednesday, January 04, 2012 11:13 PM GMT

When I say 'a while back', I meant literally a while ago, probably about two years ago. Anyway, I like knowing what each variable is in my script, and exactly how it is set. ×Dyslexic Scripter at Work×

    of     1