Attempt to index number with 'LineVelocity'

I keep getting this error, attempt to index number with 'LineVelocity', upon reaching the max speed (30 in this case), works perfectly fine up until then

UIS.InputBegan:Connect(function(input, isTyping)
	if not isTyping then
		if input.KeyCode == Enum.KeyCode.W then
			if not Pressed then
				Pressed = true
				repeat task.wait(1/Acceleration.Value)
					if Velocity.LineVelocity >= MaxSpeed.Value then
						Velocity = MaxSpeed.Value
					elseif Velocity.LineVelocity < MaxSpeed.Value then
						Velocity.LineVelocity += 1
					end
				until not Pressed
			end
		end
	end
end)

I’ve tried adding tonumbers, changing the format of it and nothing has worked so far.

You should change the property, Velocity.LineVelocity = MaxSpeed.Value

1 Like

Thanks, noticed that but it was erroring on the previous line which led me to believe it was to do with that specific line of code. Realised now it’s because that’s the line where the function is run

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