How do you make a balloon?

Heyo Devforum! Recently, I have been making ziplines and balloons. I already have a functional zipline made, but now I am trying to script a balloon. I decided to use somewhat of the same script I had for my zipline, but this time added a body force to make the player float. The only problem is that the force is either too fast, too slow, or it just doesn’t work. Here is my current script:

local debounce = false

script.Parent.Touched:Connect(function(hit)
	local balloon = script.Balloon
	local holderpart = balloon.Holder
	local timeuntilpop = script.Parent.Parent.TimeUntilPop
	local animation = script.BalloonHold
	if hit.Parent:FindFirstChild("Humanoid") then
		if not debounce then
			debounce = true
			local player = game.Players:GetPlayerFromCharacter(hit.Parent)
			local character = hit.Parent
			local humanoid = character.Humanoid
			local weld = Instance.new("Weld")
			weld.Part0 = character.Head
			weld.Part1 = holderpart
			weld.C1 = CFrame.new(0,-1,0)
			weld.Parent = holderpart
			holderpart.CFrame = character.Head.CFrame
			local loadanimation = humanoid:LoadAnimation(animation)
			loadanimation:Play()
			local bodyforce = Instance.new("BodyForce", balloon.Sphere)
			bodyforce.Force = Vector3.new(0,600,0)
			wait(timeuntilpop.Value)
			weld:Destroy()
			loadanimation:Stop()
			bodyforce:Destroy()
			debounce = false
		end
	end
end)

Is there a way that I can make the player float slowly upwards without using body forces?

3 Likes
local bodyforce = Instance.new("BodyForce", balloon.Sphere)
bodyforce.Force = Vector3.new(0,600,0)

Why are you adding bodyforce to the sphere of the balloon? When you’re creating something that involves the player floating, it’s always best to use bodyforces within their character. For example, like their torso.

The only problem is that the force is either too fast, too slow, or it just doesn’t work. Here is my current script

Perhaps it has something to do with the weight of the object that is causing this. Physics is still accounted for when trying to code bodyforces, so there may be weights that are activated that are affecting this. Another reason why it’s better to do it in the character instead of an individual basepart that is not attached to the character.

Also…(?)… I think BodyVelocity would be better suited for this case because you can control rather the velocity of the force and how fast it goes, vs the position of the force. Here’s an example of how I used it in my propeller script I made a month or two ago.

-- Obviously not the entire script, just a chunk of it
RemoteEvent.OnServerEvent:Connect(function(Player)
    Vel.Parent = Player.Character.Torso -- Create new velicoty inside humanoid root part
    Vel.Name = "FlyVelocity"
    Vel.MaxForce = Vector3.new(0,999999999,0)
 	Vel.P = 9999999999999
  	Vel.Velocity = Vector3.new(0,10,0)
   	Player.Character.Torso.Propeller.Pitch = 1
	
	wait()
	
end)
 
 
RemoteEvent2.OnServerEvent:Connect(function(Player)
	Vel.MaxForce = Vector3.new(0,2300,0)
	Vel.P = 1250
	Vel.Velocity = Vector3.new(0,0,0)
	Player.Character.Torso.Propeller.Pitch = .8
end)

Then I have another script that serves as an indicator, which tells the Server when a player holds a certain keyboard key or when they let go of that key.

BodyVelocity is definitely something worth exploring if you’re interested in controlling the speed.

EDIT: here’s a video of how I used BodyVelocity to my advantage and how it looks like in action:

4 Likes