Heyo Devforum! Recently, I have been trying to create a functional balloon using body forces, but I have run into a problem where multiple body forces are inserted at a time.
Here is my script inside a part:
script.Parent.Touched:Connect(function(hit)
local balloon = script.Balloon
local holderpart = balloon.Holder
local timeuntilpop = script.Parent.Parent.TimeUntilPop
local animation = script.BalloonHold
local isonb = false
if hit.Parent:FindFirstChild("Humanoid") and not isonb then
isonb = 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,1000,0)
wait(timeuntilpop.Value)
weld:Destroy()
loadanimation:Stop()
bodyforce:Destroy()
isonb = false
end
end)
Isonb is supposed to be the debounce. I tried adding another debounce, but that didn’t work. What do I do from here?