Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Gravity script not working? [SOLVED]

So im making something and the script says no errors but wont work is there something wrong with this script ?

script.Parent.Touched:connect(function(hit)

if hit.Parent:FindFirstChild("Humanoid") then

    local bodyForce = Instance.new("BodyForce", hit.Parent.Torso)
	bodyForce.force = Vector3.new(0,300,0)
end

end)

2 comments

0

Try using more force. Sometimes ROBLOX needs a lot of force to do things.

0

The actual force you want to apply is the (mass of the body) * 9.81 * 20

1 answer

So there wasn't a problem with the script, just raise the gravity. But you had an issue where it kept cloning it in the player. So here it is.

script.Parent.Touched:connect(function(hit)
	if hit.Parent:FindFirtChild("Humanoid") then
		if hit.Parent.Torso:FindFirstChild("BodyForce") then--If already one in torso
			--Nothing
		else
			local bodyForce = Instance.new("BodyForce", hit.Parent.Torso)
			bodyForce.force = Vector3.new(0,300,0)			
		end
	end
end)

2 comments

0

Thanks

0

On line 2 you spelled something wrong! if hit.Parent:FindFirstChild("Humanoid") then *****

This discussion is preserved as it was. New answers, comments, and votes are closed.