What is a mul error

Hello Devs,
So I’ve ran into a error that I have never seen or have ran into before. Its a mul error talking about how its not finding the number which im very confused about on why its doing that. Please help me.

– Function –

	local function Math1(BarSize,Percent)
		local Max = 0
		local Min = 2.25
		local Miss = 0
		--
		if BarSize >= 0 and BarSize <= 1 then
			Miss = (Percent * (Max - -Min)/100) + -Min
		end
		return Miss
	end
	--

– Screen Shot –

It’s talking about multiplication. You’re multiplying nil (probably Percent) and a number, which obviously can’t happen. What are inputting into the function?

The size of a Interface (char 2.0)

Could you give the code calling the function?

local function Release(Ball,Goal,BarSize,Percent)
		local Magnitude = (Ball.Position - Goal.Position).Magnitude
		local Travel = 1.1 + (Magnitude/110)
		local Gravity = Vector3.new(0,-196.2/math.pi,0)
		local X0 = Ball.Position
		local V0 = (Goal.Position - X0 - 0.5 * Gravity * Travel * Travel)/Travel/1.045
		local Offset = Math1(BarSize,Percent)
		--
		Ball.Connect.Part0 = nil
		Ball.Parent = workspace
		Ball.CanCollide = true
		Ball.Velocity = V0 + Vector3.new(Offset,Offset,Offset)
		Ball.RotVelocity = Vector3.new(0,0,25)
		wait(Count)
		Ball.Values.ballParent.Value = ''
	end
if Direction == 'Stand' then
			AnimTable['Normal']:Play(0.25)
			AnimTable['Normal'].KeyframeReached:Connect(function(Frame)
				if Frame == 'Release' then
					AnimTable['Normal']:AdjustSpeed(1)
					local Percent = Math2(Bar.Size.Y.Scale)
					Release(Char:FindFirstChild('Ball'),Goal,Bar.Size.Y.Scale,Percent)
					--
					Gyro:Destroy()
					Values.Shoot.Value = false
				end
			end)

These codes use the function

Math2 is returning nil probably; can you show the code for that function?

local function Math2(BarSize)
		if BarSize >= 0 and BarSize <= 1 then
			BarSize = 0.5 - (0.5 - BarSize) * 1
		end
		--
		local BasePercent = 100
		local BoostPercent = Values:FindFirstChild('Boost').Value
		local Percent = math.clamp((BasePercent + BoostPercent - math.floor(HumanoidRootPart.Position.X)),0,100)
		local RoundedPercent = math.floor(Percent)
		print(RoundedPercent .. '%')
	end

You never return anything from the function, hence the nil error.

I forgot to return the rounded percent :sob: I never realized

why are you using wait()? task.wait() is a much better thing as preformance speeds up

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