Better Function

you could always make script 2 more efficient:

local humanoid = script:FindFirstChildWhichIsA('Humanoid') :: Humanoid --Change This
local HumanoidConnection, HumanoidAncestryChanged
local jumping = true

HumanoidConnection = humanoid.StateChanged:Connect(function(old: Enum.HumanoidStateType, new: Enum.HumanoidStateType)
	if old == Enum.HumanoidStateType.Freefall or new == Enum.HumanoidStateType.Landed then
		jumping = false
	end
end)

HumanoidAncestryChanged = humanoid.AncestryChanged:Connect(function(child: Instance, parent: Instance)
	if parent == nil then
		HumanoidConnection:Disconnect()
		HumanoidAncestryChanged:Disconnect()
	end
end)
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.